var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  return value;
};
import { Overlay, Map as Map$1, Observable, Feature } from "ol";
import Draw, { createBox } from "ol/interaction/Draw";
import DoubleClickZoom from "ol/interaction/DoubleClickZoom";
import { Style, Fill, Stroke, Circle as Circle$2, Icon, RegularShape, Text } from "ol/style";
import { Group, Vector } from "ol/layer";
import { Vector as Vector$1 } from "ol/source";
import DragPan from "ol/interaction/DragPan";
import BaseEvent from "ol/events/Event";
import { Point as Point$2, LineString, Polygon as Polygon$2, Geometry as Geometry$1 } from "ol/geom";
import { fromExtent } from "ol/geom/Polygon";
import { boundingExtent, getSize, getBottomLeft, getTopRight, buffer } from "ol/extent";
import { asArray, asString } from "ol/color";
import { toLonLat, fromLonLat } from "ol/proj";
const index = "";
const FITTING_COUNT = 100;
const HALF_PI = Math.PI / 2;
const ZERO_TOLERANCE = 1e-4;
const BASE_LAYERNAME = "ol-plot-vector-layer";
const BASE_HELP_CONTROL_POINT_ID = "plot-helper-control-point-div";
const BASE_HELP_HIDDEN = "plot-helper-hidden-div";
const DEF_TEXT_STYEL = {
  // 默认文本框样式
  borderRadius: "2px",
  fontSize: "12px",
  outline: 0,
  overflow: "hidden",
  boxSizing: "border-box",
  border: "1px solid #eeeeee",
  fontFamily: "Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Noto Sans CJK SC,WenQuanYi Micro Hei,Arial,sans-serif",
  color: "#010500",
  fontWeight: 400,
  padding: "3px",
  fontStretch: "normal",
  lineHeight: "normal",
  textAlign: "left",
  marginLeft: "auto",
  marginRight: "auto",
  width: "auto",
  height: "auto",
  background: "rgb(255, 255, 255)",
  fontStyle: "",
  fontVariant: ""
};
const MathDistance = (pnt1, pnt2) => {
  return Math.sqrt((pnt1[0] - pnt2[0]) ** 2 + (pnt1[1] - pnt2[1]) ** 2);
} 
const MathDistanceLonLat = (pnt1, pnt2) => {
  pnt1 = fromLonLat(pnt1);
  pnt2 = fromLonLat(pnt2);
  return Math.sqrt((pnt1[0] - pnt2[0]) ** 2 + (pnt1[1] - pnt2[1]) ** 2);
}
const wholeDistance = (points) => {
  let distance = 0;
  if (points && Array.isArray(points) && points.length > 0) {
    points.forEach((item, index2) => {
      if (index2 < points.length - 1) {
        distance += MathDistance(item, points[index2 + 1]);
      }
    });
  }
  return distance;
};
const getBaseLength = (points) => wholeDistance(points) ** 0.99;
const Mid = (point1, point2) => [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
const getCircleCenterOfThreePoints = (point1, point2, point3) => {
  const pntA = [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
  const pntB = [pntA[0] - point1[1] + point2[1], pntA[1] + point1[0] - point2[0]];
  const pntC = [(point1[0] + point3[0]) / 2, (point1[1] + point3[1]) / 2];
  const pntD = [pntC[0] - point1[1] + point3[1], pntC[1] + point1[0] - point3[0]];
  return getIntersectPoint(pntA, pntB, pntC, pntD);
};
const getIntersectPoint = (pntA, pntB, pntC, pntD) => {
  if (pntA[1] === pntB[1]) {
    const f2 = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1]);
    const x2 = f2 * (pntA[1] - pntC[1]) + pntC[0];
    const y2 = pntA[1];
    return [x2, y2];
  }
  if (pntC[1] === pntD[1]) {
    const e22 = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1]);
    const x2 = e22 * (pntC[1] - pntA[1]) + pntA[0];
    const y2 = pntC[1];
    return [x2, y2];
  }
  const e2 = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1]);
  const f = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1]);
  const y = (e2 * pntA[1] - pntA[0] - f * pntC[1] + pntC[0]) / (e2 - f);
  const x = e2 * y - e2 * pntA[1] + pntA[0];
  return [x, y];
};
const getAzimuth = (startPoint, endPoint) => {
  let azimuth = 0;
  const angle = Math.asin(Math.abs(endPoint[1] - startPoint[1]) / MathDistance(startPoint, endPoint));
  if (endPoint[1] >= startPoint[1] && endPoint[0] >= startPoint[0]) {
    azimuth = angle + Math.PI;
  } else if (endPoint[1] >= startPoint[1] && endPoint[0] < startPoint[0]) {
    azimuth = Math.PI * 2 - angle;
  } else if (endPoint[1] < startPoint[1] && endPoint[0] < startPoint[0]) {
    azimuth = angle;
  } else if (endPoint[1] < startPoint[1] && endPoint[0] >= startPoint[0]) {
    azimuth = Math.PI - angle;
  }
  return azimuth;
};
const getAngleOfThreePoints = (pntA, pntB, pntC) => {
  const angle = getAzimuth(pntB, pntA) - getAzimuth(pntB, pntC);
  return angle < 0 ? angle + Math.PI * 2 : angle;
};
const isClockWise = (pnt1, pnt2, pnt3) => (pnt3[1] - pnt1[1]) * (pnt2[0] - pnt1[0]) > (pnt2[1] - pnt1[1]) * (pnt3[0] - pnt1[0]);
const getCubicValue = (t2, startPnt, cPnt1, cPnt2, endPnt) => {
  t2 = Math.max(Math.min(t2, 1), 0);
  const [tp, t22] = [1 - t2, t2 * t2];
  const t3 = t22 * t2;
  const tp2 = tp * tp;
  const tp3 = tp2 * tp;
  const x = tp3 * startPnt[0] + 3 * tp2 * t2 * cPnt1[0] + 3 * tp * t22 * cPnt2[0] + t3 * endPnt[0];
  const y = tp3 * startPnt[1] + 3 * tp2 * t2 * cPnt1[1] + 3 * tp * t22 * cPnt2[1] + t3 * endPnt[1];
  return [x, y];
};
const getThirdPoint = (startPnt, endPnt, angle, distance, clockWise) => {
  const azimuth = getAzimuth(startPnt, endPnt);
  const alpha = clockWise ? azimuth + angle : azimuth - angle;
  const dx = distance * Math.cos(alpha);
  const dy = distance * Math.sin(alpha);
  return [endPnt[0] + dx, endPnt[1] + dy];
};
const getArcPoints = (center, radius, startAngle, endAngle) => {
  let [x, y, pnts, angleDiff] = [0, 0, [], endAngle - startAngle];
  angleDiff = angleDiff < 0 ? angleDiff + Math.PI * 2 : angleDiff;
  for (let i = 0; i <= 100; i++) {
    const angle = startAngle + angleDiff * i / 100;
    x = center[0] + radius * Math.cos(angle);
    y = center[1] + radius * Math.sin(angle);
    pnts.push([x, y]);
  }
  return pnts;
};
const getBisectorNormals = (t2, pnt1, pnt2, pnt3) => {
  const normal = getNormal(pnt1, pnt2, pnt3);
  let [bisectorNormalRight, bisectorNormalLeft, dt, x, y] = [
    [0, 0],
    [0, 0],
    0,
    0,
    0
  ];
  const dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  const uX = normal[0] / dist;
  const uY = normal[1] / dist;
  const d1 = MathDistance(pnt1, pnt2);
  const d2 = MathDistance(pnt2, pnt3);
  if (dist > ZERO_TOLERANCE) {
    if (isClockWise(pnt1, pnt2, pnt3)) {
      dt = t2 * d1;
      x = pnt2[0] - dt * uY;
      y = pnt2[1] + dt * uX;
      bisectorNormalRight = [x, y];
      dt = t2 * d2;
      x = pnt2[0] + dt * uY;
      y = pnt2[1] - dt * uX;
      bisectorNormalLeft = [x, y];
    } else {
      dt = t2 * d1;
      x = pnt2[0] + dt * uY;
      y = pnt2[1] - dt * uX;
      bisectorNormalRight = [x, y];
      dt = t2 * d2;
      x = pnt2[0] - dt * uY;
      y = pnt2[1] + dt * uX;
      bisectorNormalLeft = [x, y];
    }
  } else {
    x = pnt2[0] + t2 * (pnt1[0] - pnt2[0]);
    y = pnt2[1] + t2 * (pnt1[1] - pnt2[1]);
    bisectorNormalRight = [x, y];
    x = pnt2[0] + t2 * (pnt3[0] - pnt2[0]);
    y = pnt2[1] + t2 * (pnt3[1] - pnt2[1]);
    bisectorNormalLeft = [x, y];
  }
  return [bisectorNormalRight, bisectorNormalLeft];
};
const getNormal = (pnt1, pnt2, pnt3) => {
  let dX1 = pnt1[0] - pnt2[0];
  let dY1 = pnt1[1] - pnt2[1];
  const d1 = Math.sqrt(dX1 * dX1 + dY1 * dY1);
  dX1 /= d1;
  dY1 /= d1;
  let dX2 = pnt3[0] - pnt2[0];
  let dY2 = pnt3[1] - pnt2[1];
  const d2 = Math.sqrt(dX2 * dX2 + dY2 * dY2);
  dX2 /= d2;
  dY2 /= d2;
  const uX = dX1 + dX2;
  const uY = dY1 + dY2;
  return [uX, uY];
};
const getLeftMostControlPoint = (controlPoints, t2) => {
  let [pnt1, pnt2, pnt3, controlX, controlY] = [controlPoints[0], controlPoints[1], controlPoints[2], 0, 0];
  const pnts = getBisectorNormals(0, pnt1, pnt2, pnt3);
  const normalRight = pnts[0];
  const normal = getNormal(pnt1, pnt2, pnt3);
  const dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  if (dist > ZERO_TOLERANCE) {
    const mid = Mid(pnt1, pnt2);
    const pX = pnt1[0] - mid[0];
    const pY = pnt1[1] - mid[1];
    const d1 = MathDistance(pnt1, pnt2);
    const n2 = 2 / d1;
    const nX = -n2 * pY;
    const nY = n2 * pX;
    const a11 = nX * nX - nY * nY;
    const a12 = 2 * nX * nY;
    const a22 = nY * nY - nX * nX;
    const dX = normalRight[0] - mid[0];
    const dY = normalRight[1] - mid[1];
    controlX = mid[0] + a11 * dX + a12 * dY;
    controlY = mid[1] + a12 * dX + a22 * dY;
  } else {
    controlX = pnt1[0] + t2 * (pnt2[0] - pnt1[0]);
    controlY = pnt1[1] + t2 * (pnt2[1] - pnt1[1]);
  }
  return [controlX, controlY];
};
const getRightMostControlPoint = (controlPoints, t2) => {
  const count = controlPoints.length;
  const pnt1 = controlPoints[count - 3];
  const pnt2 = controlPoints[count - 2];
  const pnt3 = controlPoints[count - 1];
  const pnts = getBisectorNormals(0, pnt1, pnt2, pnt3);
  const normalLeft = pnts[1];
  const normal = getNormal(pnt1, pnt2, pnt3);
  const dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  let [controlX, controlY] = [0, 0];
  if (dist > ZERO_TOLERANCE) {
    const mid = Mid(pnt2, pnt3);
    const pX = pnt3[0] - mid[0];
    const pY = pnt3[1] - mid[1];
    const d1 = MathDistance(pnt2, pnt3);
    const n2 = 2 / d1;
    const nX = -n2 * pY;
    const nY = n2 * pX;
    const a11 = nX * nX - nY * nY;
    const a12 = 2 * nX * nY;
    const a22 = nY * nY - nX * nX;
    const dX = normalLeft[0] - mid[0];
    const dY = normalLeft[1] - mid[1];
    controlX = mid[0] + a11 * dX + a12 * dY;
    controlY = mid[1] + a12 * dX + a22 * dY;
  } else {
    controlX = pnt3[0] + t2 * (pnt2[0] - pnt3[0]);
    controlY = pnt3[1] + t2 * (pnt2[1] - pnt3[1]);
  }
  return [controlX, controlY];
};
const getCurvePoints = (t2, controlPoints) => {
  const leftControl = getLeftMostControlPoint(controlPoints, t2);
  let [pnt1, pnt2, pnt3, normals] = [null, null, null, [leftControl]];
  const points = [];
  for (let i = 0; i < controlPoints.length - 2; i++) {
    [pnt1, pnt2, pnt3] = [controlPoints[i], controlPoints[i + 1], controlPoints[i + 2]];
    const normalPoints = getBisectorNormals(t2, pnt1, pnt2, pnt3);
    normals = normals.concat(normalPoints);
  }
  const rightControl = getRightMostControlPoint(controlPoints, t2);
  if (rightControl) {
    normals.push(rightControl);
  }
  for (let i = 0; i < controlPoints.length - 1; i++) {
    pnt1 = controlPoints[i];
    pnt2 = controlPoints[i + 1];
    points.push(pnt1);
    for (let j = 0; j < FITTING_COUNT; j++) {
      const pnt = getCubicValue(j / FITTING_COUNT, pnt1, normals[i * 2], normals[i * 2 + 1], pnt2);
      points.push(pnt);
    }
    points.push(pnt2);
  }
  return points;
};
const getBezierPoints = function(points) {
  if (points.length <= 2) {
    return points;
  }
  const bezierPoints = [];
  const n2 = points.length - 1;
  for (let t2 = 0; t2 <= 1; t2 += 0.01) {
    let [x, y] = [0, 0];
    for (let index2 = 0; index2 <= n2; index2++) {
      const factor = getBinomialFactor(n2, index2);
      const a = t2 ** index2;
      const b = (1 - t2) ** (n2 - index2);
      x += factor * a * b * points[index2][0];
      y += factor * a * b * points[index2][1];
    }
    bezierPoints.push([x, y]);
  }
  bezierPoints.push(points[n2]);
  return bezierPoints;
};
const getFactorial = (n2) => {
  let result = 1;
  switch (true) {
    case n2 <= 1:
      result = 1;
      break;
    case n2 === 2:
      result = 2;
      break;
    case n2 === 3:
      result = 6;
      break;
    case n2 === 24:
      result = 24;
      break;
    case n2 === 5:
      result = 120;
      break;
    default:
      for (let i = 1; i <= n2; i++) {
        result *= i;
      }
      break;
  }
  return result;
};
const getBinomialFactor = (n2, index2) => getFactorial(n2) / (getFactorial(index2) * getFactorial(n2 - index2));
const getQBSplinePoints = (points) => {
  if (points.length <= 2) {
    return points;
  }
  const [n2, bSplinePoints] = [2, []];
  const m = points.length - n2 - 1;
  bSplinePoints.push(points[0]);
  for (let i = 0; i <= m; i++) {
    for (let t2 = 0; t2 <= 1; t2 += 0.05) {
      let [x, y] = [0, 0];
      for (let k = 0; k <= n2; k++) {
        const factor = getQuadricBSplineFactor(k, t2);
        x += factor * points[i + k][0];
        y += factor * points[i + k][1];
      }
      bSplinePoints.push([x, y]);
    }
  }
  bSplinePoints.push(points[points.length - 1]);
  return bSplinePoints;
};
const getQuadricBSplineFactor = (k, t2) => {
  let res = 0;
  if (k === 0) {
    res = (t2 - 1) ** 2 / 2;
  } else if (k === 1) {
    res = (-2 * t2 ** 2 + 2 * t2 + 1) / 2;
  } else if (k === 2) {
    res = t2 ** 2 / 2;
  }
  return res;
};
function getuuid(noBit = false) {
  function b(a) {
    return a ? (a ^ Math.random() * 16 >> a / 4).toString(16) : ([1e7] + -[1e3] + -4e3 + -8e3 + -1e11).replace(/[018]/g, b);
  }
  return noBit ? b().replace(/-/g, "") : b();
}
const isObject = (value) => {
  const type = typeof value;
  return value !== null && (type === "object" || type === "function");
};
const merge = (a, b) => {
  for (const key in b) {
    if (isObject(b[key]) && isObject(a[key])) {
      merge(a[key], b[key]);
    } else {
      a[key] = b[key];
    }
  }
  return a;
};
function bindAll(fns, context) {
  fns.forEach((fn) => {
    if (!context[fn]) {
      return;
    }
    context[fn] = context[fn].bind(context);
  });
}
const getLayerByLayerName = function(map, layerName) {
  try {
    let targetLayer = null;
    if (map) {
      const layers = map.getLayers().getArray();
      targetLayer = getLayerInternal(layers, "layerName", layerName);
    }
    return targetLayer;
  } catch (e2) {
    console.log(e2);
    return null;
  }
};
const getLayerInternal = function(layers, key, value) {
  let _target = null;
  if (layers.length > 0) {
    layers.every((layer) => {
      if (layer instanceof Group) {
        const ly = layer.getLayers().getArray();
        _target = getLayerInternal(ly, key, value);
        return !_target;
      }
      if (layer.get(key) === value) {
        _target = layer;
        return false;
      }
      return true;
    });
  }
  return _target;
};
const createVectorLayer = function(map, layerName, params) {
  try {
    if (map) {
      let vectorLayer = getLayerByLayerName(map, layerName);
      if (!(vectorLayer instanceof Vector)) {
        vectorLayer = null;
      }
      if (!vectorLayer) {
        if (params && params.create) {
          vectorLayer = new Vector({
            // @ts-ignore this is unsafe
            layerName,
            params,
            layerType: "vector",
            source: new Vector$1({
              wrapX: false
            }),
            style: new Style({
              fill: new Fill({
                color: "rgba(67, 110, 238, 0.4)"
              }),
              stroke: new Stroke({
                color: "#4781d9",
                width: 2
              }),
              image: new Circle$2({
                radius: 7,
                fill: new Fill({
                  color: "#ffcc33"
                })
              })
            })
          });
        }
      }
      if (map && vectorLayer) {
        if (params && params.hasOwnProperty("selectable")) {
          vectorLayer.set("selectable", params.selectable);
        }
        const _vectorLayer = getLayerByLayerName(map, layerName);
        if (!_vectorLayer || !(_vectorLayer instanceof Vector)) {
          map.addLayer(vectorLayer);
        }
      }
      return vectorLayer;
    }
  } catch (e2) {
    console.error(e2);
  }
};
var PlotTypes = /* @__PURE__ */ ((PlotTypes2) => {
  PlotTypes2["TEXTAREA"] = "TextArea";
  PlotTypes2["ARC"] = "Arc";
  PlotTypes2["CURVE"] = "Curve";
  PlotTypes2["GATHERING_PLACE"] = "GatheringPlace";
  PlotTypes2["POLYLINE"] = "Polyline";
  PlotTypes2["FREEHANDLINE"] = "FreeHandLine";
  PlotTypes2["POINT"] = "Point";
  PlotTypes2["PENNANT"] = "Pennant";
  PlotTypes2["RECTANGLE"] = "RectAngle";
  PlotTypes2["CIRCLE"] = "Circle";
  PlotTypes2["ELLIPSE"] = "Ellipse";
  PlotTypes2["LUNE"] = "Lune";
  PlotTypes2["SECTOR"] = "Sector";
  PlotTypes2["CLOSED_CURVE"] = "ClosedCurve";
  PlotTypes2["POLYGON"] = "Polygon";
  PlotTypes2["FREE_POLYGON"] = "FreePolygon";
  PlotTypes2["ATTACK_ARROW"] = "AttackArrow";
  PlotTypes2["DOUBLE_ARROW"] = "DoubleArrow";
  PlotTypes2["STRAIGHT_ARROW"] = "StraightArrow";
  PlotTypes2["FINE_ARROW"] = "FineArrow";
  PlotTypes2["ASSAULT_DIRECTION"] = "AssaultDirection";
  PlotTypes2["TAILED_SQUAD_COMBAT"] = "TailedSquadCombat";
  PlotTypes2["TAILED_ATTACK_ARROW"] = "TailedAttackArrow";
  PlotTypes2["SQUAD_COMBAT"] = "SquadCombat";
  PlotTypes2["RECTFLAG"] = "RectFlag";
  PlotTypes2["TRIANGLEFLAG"] = "TriangleFlag";
  PlotTypes2["CURVEFLAG"] = "CurveFlag";
  PlotTypes2["RECTINCLINED1"] = "RectInclined1";
  PlotTypes2["RECTINCLINED2"] = "RectInclined2";
  return PlotTypes2;
})(PlotTypes || {});
var e = /* @__PURE__ */ new Map();
function t(t2) {
  var o2 = e.get(t2);
  o2 && o2.destroy();
}
function o(t2) {
  var o2 = e.get(t2);
  o2 && o2.update();
}
var r = null;
"undefined" == typeof window ? ((r = function(e2) {
  return e2;
}).destroy = function(e2) {
  return e2;
}, r.update = function(e2) {
  return e2;
}) : ((r = function(t2, o2) {
  return t2 && Array.prototype.forEach.call(t2.length ? t2 : [t2], function(t3) {
    return function(t4) {
      if (t4 && t4.nodeName && "TEXTAREA" === t4.nodeName && !e.has(t4)) {
        var o3, r2 = null, n2 = window.getComputedStyle(t4), i = (o3 = t4.value, function() {
          a({ testForHeightReduction: "" === o3 || !t4.value.startsWith(o3), restoreTextAlign: null }), o3 = t4.value;
        }), l = (function(o4) {
          t4.removeEventListener("autosize:destroy", l), t4.removeEventListener("autosize:update", s), t4.removeEventListener("input", i), window.removeEventListener("resize", s), Object.keys(o4).forEach(function(e2) {
            return t4.style[e2] = o4[e2];
          }), e.delete(t4);
        }).bind(t4, { height: t4.style.height, resize: t4.style.resize, textAlign: t4.style.textAlign, overflowY: t4.style.overflowY, overflowX: t4.style.overflowX, wordWrap: t4.style.wordWrap });
        t4.addEventListener("autosize:destroy", l), t4.addEventListener("autosize:update", s), t4.addEventListener("input", i), window.addEventListener("resize", s), t4.style.overflowX = "hidden", t4.style.wordWrap = "break-word", e.set(t4, { destroy: l, update: s }), s();
      }
      function a(e2) {
        var o4, i2, l2 = e2.restoreTextAlign, s2 = void 0 === l2 ? null : l2, d = e2.testForHeightReduction, u = void 0 === d || d, c = n2.overflowY;
        if (0 !== t4.scrollHeight && ("vertical" === n2.resize ? t4.style.resize = "none" : "both" === n2.resize && (t4.style.resize = "horizontal"), u && (o4 = function(e3) {
          for (var t5 = []; e3 && e3.parentNode && e3.parentNode instanceof Element; )
            e3.parentNode.scrollTop && t5.push([e3.parentNode, e3.parentNode.scrollTop]), e3 = e3.parentNode;
          return function() {
            return t5.forEach(function(e4) {
              var t6 = e4[0], o5 = e4[1];
              t6.style.scrollBehavior = "auto", t6.scrollTop = o5, t6.style.scrollBehavior = null;
            });
          };
        }(t4), t4.style.height = ""), i2 = "content-box" === n2.boxSizing ? t4.scrollHeight - (parseFloat(n2.paddingTop) + parseFloat(n2.paddingBottom)) : t4.scrollHeight + parseFloat(n2.borderTopWidth) + parseFloat(n2.borderBottomWidth), "none" !== n2.maxHeight && i2 > parseFloat(n2.maxHeight) ? ("hidden" === n2.overflowY && (t4.style.overflow = "scroll"), i2 = parseFloat(n2.maxHeight)) : "hidden" !== n2.overflowY && (t4.style.overflow = "hidden"), t4.style.height = i2 + "px", s2 && (t4.style.textAlign = s2), o4 && o4(), r2 !== i2 && (t4.dispatchEvent(new Event("autosize:resized", { bubbles: true })), r2 = i2), c !== n2.overflow && !s2)) {
          var v = n2.textAlign;
          "hidden" === n2.overflow && (t4.style.textAlign = "start" === v ? "end" : "start"), a({ restoreTextAlign: v, testForHeightReduction: true });
        }
      }
      function s() {
        a({ testForHeightReduction: true, restoreTextAlign: null });
      }
    }(t3);
  }), t2;
}).destroy = function(e2) {
  return e2 && Array.prototype.forEach.call(e2.length ? e2 : [e2], t), e2;
}, r.update = function(e2) {
  return e2 && Array.prototype.forEach.call(e2.length ? e2 : [e2], o), e2;
});
var n = r;
const SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
const MOZ_HACK_REGEXP = /^moz([A-Z])/;
const create = function(tagName, className, container, id) {
  const el = document.createElement(tagName);
  el.className = className || "";
  if (id) {
    el.id = id;
  }
  if (container) {
    container.appendChild(el);
  }
  return el;
};
const getElement = function(id) {
  return typeof id === "string" ? document.getElementById(id) : id;
};
const remove = function(el, p) {
  const parent = el.parentNode;
  if (parent) {
    parent.removeChild(el);
  }
};
const createHidden = function(tagName, parent, id) {
  const element = document.createElement(tagName);
  element.style.display = "none";
  if (id) {
    element.id = id;
  }
  if (parent) {
    parent.appendChild(element);
  }
  return element;
};
const camelCase = function(name) {
  return name.replace(SPECIAL_CHARS_REGEXP, (_, separator, letter, offset) => offset ? letter.toUpperCase() : letter).replace(MOZ_HACK_REGEXP, "Moz$1");
};
const on = function() {
  if (document) {
    return function(element, event, handler) {
      if (element && event && handler) {
        element.addEventListener(event, handler, false);
      }
    };
  }
}();
const off = function() {
  if (document) {
    return function(element, event, handler) {
      if (element && event) {
        element.removeEventListener(event, handler, false);
      }
    };
  }
}();
function hasClass(el, cls) {
  if (!el || !cls)
    return false;
  if (cls.indexOf(" ") !== -1)
    throw new Error("className should not contain space.");
  if (el.classList) {
    return el.classList.contains(cls);
  }
  return ` ${el.className} `.indexOf(` ${cls} `) > -1;
}
function getStyle(element, styleName) {
  var _a;
  if (!element || !styleName)
    return null;
  styleName = camelCase(styleName);
  if (styleName === "float") {
    styleName = "cssFloat";
  }
  try {
    const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, "");
    return element.style[styleName] || computed ? computed == null ? void 0 : computed[styleName] : null;
  } catch (e2) {
    return element.style[styleName];
  }
}
function setStyle(element, styleName, value) {
  if (!element || !styleName)
    return;
  if (typeof styleName === "object") {
    for (const prop in styleName) {
      if (styleName.hasOwnProperty(prop)) {
        setStyle(element, prop, styleName[prop]);
      }
    }
  } else {
    styleName = camelCase(styleName);
    if (styleName === "opacity") {
      element.style.filter = isNaN(value) ? "" : `alpha(opacity=${value * 100})`;
    } else {
      element.style[styleName] = value;
    }
  }
}
class PlotEvent extends BaseEvent {
  constructor(type, params = {}) {
    super(type);
    Object.keys(params).forEach((key) => {
      this[key] = params[key];
    });
  }
}
class PlotTextBox extends Overlay {
  // eslint-disable-next-line default-param-last
  constructor(options = {}, parent) {
    const [
      id,
      element,
      offset,
      stopEvent,
      positioning,
      insertFirst,
      autoPan,
      autoPanAnimation,
      autoPanMargin,
      className
    ] = [
      options.id,
      options.element,
      options.offset,
      options.stopEvent,
      options.positioning,
      options.insertFirst,
      options.autoPan,
      options.autoPanAnimation,
      options.autoPanMargin,
      options.className ? options.className : "ol-plot-text-editor"
    ];
    super({
      id,
      element,
      stopEvent,
      insertFirst,
      autoPan,
      autoPanAnimation,
      autoPanMargin,
      className
    });
    this.parent = parent;
    this.setOffset(offset !== void 0 ? offset : [0, 0]);
    this.setPositioning(positioning !== void 0 ? positioning : "center-center");
    this.mapDragPan = void 0;
    this.isClick_ = false;
    this.dragging_ = false;
    this.isFocus_ = false;
    this.options_ = options;
    this._position = options.position && options.position.length > 0 ? options.position : [];
    this.handleTimer_ = null;
    this.currentPixel_ = [];
    this.freehand = false;
    bindAll(
      [
        "handleFocus_",
        "handleBlur_",
        "handleClick_",
        "handleDragStart_",
        "handleDragEnd_",
        "handleDragDrag_",
        "closeCurrentPlotText",
        "handleResizeMouseDown_",
        "handleResizeMouseMove_",
        "handleResizeMouseUp_",
        "resizeButtonMoveHandler_"
      ],
      this
    );
    this.createTextContent(options);
  }
  /**
   * 创建文本框父容器
   * @param options
   */
  createTextContent(options) {
    const _className = options.className || "ol-plot-text-editor";
    const content = document.createElement("textarea");
    content.className = _className;
    content.style.width = `${options.width}px`;
    content.style.height = `${options.height}px`;
    content.style.minHeight = `${options.minHeight}px`;
    content.setAttribute("id", options.id);
    content.setAttribute("autofocus", true);
    n(content);
    on(content, "focus", this.handleFocus_);
    on(content, "blur", this.handleBlur_);
    on(content, "click", this.handleClick_);
    on(content, "mousedown", this.handleDragStart_);
    on(window, "mouseup", this.handleDragEnd_);
    this.set("isPlotText", true);
    this.setElement(content);
    this.createCloseButton(options);
    this.createResizeButton(options);
    this.setPosition(this._position);
    this.dispatchEvent(
      new PlotEvent("textBoxDrawEnd", {
        overlay: this,
        element: content,
        uuid: options.id
      })
    );
  }
  /**
   * 获取文本框
   * @returns {string}
   * @private
   */
  getTextAreaFromContent_() {
    let _node = "";
    const childrens_ = Array.prototype.slice.call(this.element && this.element.children, 0);
    if (childrens_.length > 0) {
      childrens_.every((ele) => {
        if (ele.nodeType === 1 && ele.nodeName.toLowerCase() === "textarea") {
          _node = ele;
          return false;
        }
        return true;
      });
    }
    return _node;
  }
  /**
   * 创建关闭按钮
   * @param options
   */
  createCloseButton(options) {
    const _closeSpan = document.createElement("span");
    _closeSpan.className = "ol-plot-text-editor-close";
    _closeSpan.setAttribute("data-id", options.id);
    off(_closeSpan, "click", this.closeCurrentPlotText);
    on(_closeSpan, "click", this.closeCurrentPlotText);
    this.element.appendChild(_closeSpan);
  }
  /**
   * 创建文本框大小调整按钮
   * @param options
   */
  createResizeButton(options) {
    const _resizeSpan = document.createElement("span");
    _resizeSpan.className = "ol-plot-text-editor-resize";
    _resizeSpan.setAttribute("data-id", options.id);
    off(_resizeSpan, "mousedown", this.handleResizeMouseDown_);
    off(_resizeSpan, "mousemove", this.handleResizeMouseMove_);
    on(_resizeSpan, "mousedown", this.handleResizeMouseDown_);
    on(_resizeSpan, "mousemove", this.handleResizeMouseMove_);
    this.element.appendChild(_resizeSpan);
  }
  /**
   * 调整大小
   * @param event
   * @private
   */
  resizeButtonMoveHandler_(event) {
    const pixel_ = event.pixel;
    const element_ = this.getTextAreaFromContent_();
    if (pixel_.length < 1 || this.currentPixel_.length < 1 || !element_)
      return;
    const _offset = [pixel_[0] - this.currentPixel_[0], pixel_[1] - this.currentPixel_[1]];
    const _size = [element_.offsetWidth, element_.offsetHeight];
    const _width = _size[0] + _offset[0] * 2;
    const _height = _size[1] + _offset[1] * 2;
    setStyle(element_, "width", `${_width}px`);
    setStyle(element_, "height", `${_height}px`);
    this.currentPixel_ = pixel_;
    this.getMap().render();
  }
  /**
   * 处理移动事件
   * @param event
   * @private
   */
  handleResizeMouseMove_(event) {
    event.stopImmediatePropagation();
  }
  /**
   * 处理鼠标按下事件
   * @param event
   * @private
   */
  handleResizeMouseDown_(event) {
    if (!this.getMap())
      return;
    this.currentPixel_ = [event.x, event.y];
    this.getMap().on("pointermove", this.resizeButtonMoveHandler_);
    on(this.getMap().getViewport(), "mouseup", this.handleResizeMouseUp_);
  }
  /**
   * 处理鼠标抬起事件，移除所有事件监听
   * @private
   */
  handleResizeMouseUp_() {
    if (!this.getMap())
      return;
    this.getMap().un("pointermove", this.resizeButtonMoveHandler_);
    off(this.getMap().getViewport(), "mouseup", this.handleResizeMouseUp_);
    this.currentPixel_ = [];
  }
  /**
   * 处理关闭事件
   * @param event
   */
  closeCurrentPlotText(event) {
    if (!this.getMap())
      return;
    if (event && hasClass(event.target, "ol-plot-text-editor-close")) {
      const _id = event.target.getAttribute("data-id");
      if (_id) {
        const _overlay = this.getMap().getOverlayById(_id);
        if (_overlay) {
          this.getMap().removeOverlay(_overlay);
        }
      }
    }
  }
  /**
   * 处理获取焦点事件
   * @private
   */
  handleFocus_() {
    this.isFocus_ = true;
    if (this.parent) {
      this.parent.dispatchEvent(
        new PlotEvent("activeTextArea", {
          overlay: this
        })
      );
    }
  }
  /**
   * 处理失去焦点事件
   * @private
   */
  handleBlur_() {
    this.isFocus_ = false;
    if (this.parent) {
      this.parent.dispatchEvent(
        new PlotEvent("deactivateTextArea", {
          overlay: this
        })
      );
    }
  }
  /**
   * 处理拖拽开始
   * @private
   */
  handleDragStart_() {
    if (!this.getMap())
      return;
    if (!this.dragging_ && this.isMoveModel() && this.isFocus_) {
      this.handleTimer_ = window.setTimeout(() => {
        window.clearTimeout(this.handleTimer_);
        this.handleTimer_ = null;
        if (!this.isClick_) {
          this.dragging_ = true;
          this.disableMapDragPan();
          this.preCursor_ = this.element.style.cursor;
          on(this.getMap().getViewport(), "mousemove", this.handleDragDrag_);
          on(this.element, "mouseup", this.handleDragEnd_);
        }
      }, 300);
    }
  }
  /**
   * 处理拖拽
   * @param event
   * @private
   */
  handleDragDrag_(event) {
    if (this.dragging_) {
      this.element.style.cursor = "move";
      this._position = this.getMap().getCoordinateFromPixel([event.clientX, event.clientY]);
      this.setPosition(this._position);
    }
  }
  /**
   * 处理拖拽
   * @private
   */
  handleDragEnd_() {
    this.isClick_ = false;
    window.clearTimeout(this.handleTimer_);
    this.handleTimer_ = null;
    if (this.dragging_ && this.isFocus_) {
      this.dragging_ = false;
      this.enableMapDragPan();
      this.element.style.cursor = this.preCursor_;
      off(this.getMap().getViewport(), "mousemove", this.handleDragDrag_);
      off(this.element, "mouseup", this.handleDragEnd_);
    }
  }
  /**
   * 处理点击事件
   * @param event
   * @private
   */
  handleClick_(event) {
    if (event.target === this.element) {
      this.isClick_ = true;
    } else {
      this.isClick_ = false;
    }
  }
  /**
   * 是否处于选择模式
   * @returns {boolean}
   */
  isMoveModel() {
    if (!window)
      return false;
    try {
      const selection = window.getSelection();
      if (selection) {
        const range = window.getSelection().getRangeAt(0);
        return range.collapsed;
      }
      return false;
    } catch (e2) {
      console.error("[ol-plot]: PlotTextBox check move error", e2);
    }
  }
  /**
   * 设置样式
   * @param style
   */
  setStyle(style = {}) {
    const _element = this.getTextAreaFromContent_();
    if (_element) {
      for (const key in style) {
        if (style[key]) {
          setStyle(_element, key, style[key]);
        }
      }
    }
  }
  /**
   * 获取当前样式
   * @returns {CSSStyleDeclaration}
   */
  getStyle() {
    const _style = {};
    const _element = this.getTextAreaFromContent_();
    if (_element) {
      for (const key in DEF_TEXT_STYEL) {
        _style[key] = getStyle(_element, key);
      }
    }
    return _style;
  }
  /**
   * set value
   * @param value
   */
  setValue(value) {
    const _element = this.getTextAreaFromContent_();
    if (_element) {
      _element.value = value;
      if (value) {
        n.update(_element);
      }
      this.getMap().render();
    }
  }
  /**
   * get value
   * @returns {*}
   */
  getValue() {
    const _element = this.getTextAreaFromContent_();
    if (_element) {
      return _element.value;
    }
    return "";
  }
  /**
   * 获取宽度
   * @returns {number}
   */
  getWidth() {
    const element_ = this.getTextAreaFromContent_();
    if (element_ && element_.offsetWidth) {
      return element_.offsetWidth;
    }
    return 0;
  }
  /**
   * 获取高度
   * @returns {number}
   */
  getHeight() {
    const element_ = this.getTextAreaFromContent_();
    if (element_ && element_.offsetHeight) {
      return element_.offsetHeight;
    }
    return 0;
  }
  /**
   * 激活地图的拖拽平移
   */
  enableMapDragPan() {
    const _map = this.getMap();
    if (!_map)
      return;
    if (this.mapDragPan) {
      _map.addInteraction(this.mapDragPan);
      delete this.mapDragPan;
    }
  }
  /**
   * 禁止地图的拖拽平移
   */
  disableMapDragPan() {
    const _map = this.getMap();
    if (!_map)
      return;
    const interactions = _map.getInteractions().getArray();
    interactions.every((item) => {
      if (item instanceof DragPan || item.constructor.name.indexOf("DragPan") > -1) {
        this.mapDragPan = item;
        _map.removeInteraction(item);
        return false;
      }
      return true;
    });
  }
  /**
   * set map
   * @param map
   */
  setMap(map) {
    super.setMap(map);
    if (map && map instanceof Map$1) {
      this.setStyle(merge(DEF_TEXT_STYEL, this.options_.style));
      this.setValue(this.options_.value);
    }
  }
  finishDrawing() {
  }
}
const PlotTextBox$1 = PlotTextBox;
class Point extends Point$2 {
  constructor(coordinates, point, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    __publicField(this, "options");
    this.type = PlotTypes.POINT;
    this.options = params || {};
    this.freehand = false;
    this.set("params", this.options);
    this.fixPointCount = 1;
    if (point && point.length > 0) {
      this.setPoints(point);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  generate() {
    const pnt = this.points[0];
    this.setCoordinates(pnt);
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {{}|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const Point$1 = Point;
class Pennant extends Point$2 {
  constructor(coordinates, point, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    __publicField(this, "options");
    this.type = PlotTypes.PENNANT;
    this.options = params || {};
    this.freehand = false;
    this.fixPointCount = void 0;
    this.set("params", this.options);
    if (point && point.length > 0) {
      this.setPoints(point);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  generate() {
    this.setCoordinates(this.points);
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {{}|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const Pennant$1 = Pennant;
class Polyline extends LineString {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    this.type = PlotTypes.POLYLINE;
    this.freehand = false;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    this.setCoordinates(this.points);
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {ol.Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const Polyline$1 = Polyline;
class Arc extends LineString {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "freehand");
    __publicField(this, "map");
    __publicField(this, "points");
    this.type = PlotTypes.ARC;
    this.fixPointCount = 3;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    const count = this.getPointCount();
    if (count < 2)
      return;
    if (count === 2) {
      this.setCoordinates(this.points);
    } else {
      let [pnt1, pnt2, pnt3, startAngle, endAngle] = [this.points[0], this.points[1], this.points[2], 0, 0];
      const center = getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
      const radius = MathDistance(pnt1, center);
      const angle1 = getAzimuth(pnt1, center);
      const angle2 = getAzimuth(pnt2, center);
      if (isClockWise(pnt1, pnt2, pnt3)) {
        startAngle = angle2;
        endAngle = angle1;
      } else {
        startAngle = angle1;
        endAngle = angle2;
      }
      this.setCoordinates(getArcPoints(center, radius, startAngle, endAngle));
    }
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {ol.Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const Arc$1 = Arc;
class Circle extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    this.type = PlotTypes.CIRCLE;
    this.fixPointCount = 2;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  generate() {
    const count = this.getPointCount();
    if (count < 2) {
      return false;
    }
    const center = this.points[0];
    const radius = MathDistanceLonLat(center, this.points[1]);
    this.setCoordinates([this.generatePoints(center, radius)]);
  }
  /**
   * 对圆边线进行插值
   * @param center
   * @param radius
   * @returns {null}
   */
  generatePoints(center, radius) {
    // 经纬度转换为墨卡托
    center = fromLonLat(center)
    let [x, y, angle] = [0, 0, 0];
    const points = [];
    for (let i = 0; i <= 100; i++) {
      angle = Math.PI * 2 * i / 100;
      x = center[0] + radius * Math.cos(angle);
      y = center[1] + radius * Math.sin(angle);
      // 墨卡托转换成经纬度
      points.push(toLonLat([x, y]));
    }
    return points;
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {{}|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const Circle$1 = Circle;
class Curve extends LineString {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    __publicField(this, "t");
    this.type = PlotTypes.CURVE;
    this.t = 0.3;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    const count = this.getPointCount();
    if (count < 2) {
      return false;
    }
    if (count === 2) {
      this.setCoordinates(this.points);
    } else {
      const points = getCurvePoints(this.t, this.points);
      this.setCoordinates(points);
    }
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {ol.Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const Curve$1 = Curve;
class FreeHandLine extends LineString {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    this.type = PlotTypes.FREEHANDLINE;
    this.freehand = true;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    this.setCoordinates(this.points);
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {ol.Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const FreeHandLine$1 = FreeHandLine;
class RectAngle extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    __publicField(this, "isFill");
    this.type = PlotTypes.RECTANGLE;
    this.fixPointCount = 2;
    this.set("params", params);
    this.isFill = params.isFill === false ? params.isFill : true;
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    if (this.points.length === 2) {
      let coordinates;
      if (this.isFill) {
        const extent = boundingExtent(this.points);
        const polygon = fromExtent(extent);
        coordinates = polygon.getCoordinates();
      } else {
        const start = this.points[0];
        const end = this.points[1];
        coordinates = [start, [start[0], end[1]], end, [end[0], start[1]], start];
      }
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const RectAngle$1 = RectAngle;
class Ellipse extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    this.type = PlotTypes.ELLIPSE;
    this.fixPointCount = 2;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  generate() {
    if (this.getPointCount() < 2) {
      return false;
    }
    const [pnt1, pnt2] = [this.points[0], this.points[1]];
    const center = Mid(pnt1, pnt2);
    const majorRadius = Math.abs((pnt1[0] - pnt2[0]) / 2);
    const minorRadius = Math.abs((pnt1[1] - pnt2[1]) / 2);
    const res = this.generatePoints(center, majorRadius, minorRadius);
    this.setCoordinates([res]);
  }
  /**
   * 对圆边线进行插值
   * @param center
   * @param majorRadius
   * @param minorRadius
   * @returns {*}
   */
  generatePoints(center, majorRadius, minorRadius) {
    let [x, y, angle] = [0, 0, 0];
    const points = [];
    for (let i = 0; i <= FITTING_COUNT; i++) {
      angle = Math.PI * 2 * i / FITTING_COUNT;
      x = center[0] + majorRadius * Math.cos(angle);
      y = center[1] + minorRadius * Math.sin(angle);
      // 墨卡托转换成经纬度
      points.push([x, y]);
    }
    return points;
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {{}|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const Ellipse$1 = Ellipse;
class Lune extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    this.type = PlotTypes.LUNE;
    this.fixPointCount = 3;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    if (this.getPointCount() < 2) {
      return false;
    }
    let pnts = this.getPoints();
    if (this.getPointCount() === 2) {
      const mid = Mid(pnts[0], pnts[1]);
      const d = MathDistance(pnts[0], mid);
      const pnt = getThirdPoint(pnts[0], mid, HALF_PI, d);
      pnts.push(pnt);
    }
    let [pnt1, pnt2, pnt3, startAngle, endAngle] = [pnts[0], pnts[1], pnts[2], 0, 0];
    const center = getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
    const radius = MathDistance(pnt1, center);
    const angle1 = getAzimuth(pnt1, center);
    const angle2 = getAzimuth(pnt2, center);
    if (isClockWise(pnt1, pnt2, pnt3)) {
      startAngle = angle2;
      endAngle = angle1;
    } else {
      startAngle = angle1;
      endAngle = angle2;
    }
    pnts = getArcPoints(center, radius, startAngle, endAngle);
    pnts.push(pnts[0]);
    this.setCoordinates([pnts]);
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const Lune$1 = Lune;
class Sector extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    this.type = PlotTypes.SECTOR;
    this.fixPointCount = 3;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    const points = this.getPointCount();
    if (points < 2) {
      return false;
    }
    if (points === 2) {
      this.setCoordinates([this.points]);
    } else {
      const pnts = this.getPoints();
      const [center, pnt2, pnt3] = [pnts[0], pnts[1], pnts[2]];
      const radius = MathDistance(pnt2, center);
      const startAngle = getAzimuth(pnt2, center);
      const endAngle = getAzimuth(pnt3, center);
      const pList = getArcPoints(center, radius, startAngle, endAngle);
      pList.push(center, pList[0]);
      this.setCoordinates([pList]);
    }
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {ol.Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const Sector$1 = Sector;
class ClosedCurve extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    __publicField(this, "t");
    this.type = PlotTypes.CLOSED_CURVE;
    this.t = 0.3;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    const points = this.getPointCount();
    if (points < 2) {
      return false;
    }
    if (points === 2) {
      this.setCoordinates([this.points]);
    } else {
      const pnts = this.getPoints();
      pnts.push(pnts[0], pnts[1]);
      let normals = [];
      const pList = [];
      for (let i = 0; i < pnts.length - 2; i++) {
        const normalPoints = getBisectorNormals(this.t, pnts[i], pnts[i + 1], pnts[i + 2]);
        normals = normals.concat(normalPoints);
      }
      const count = normals.length;
      normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
      for (let i = 0; i < pnts.length - 2; i++) {
        const pnt1 = pnts[i];
        const pnt2 = pnts[i + 1];
        pList.push(pnt1);
        for (let t2 = 0; t2 <= FITTING_COUNT; t2++) {
          const pnt = getCubicValue(
            t2 / FITTING_COUNT,
            pnt1,
            normals[i * 2],
            normals[i * 2 + 1],
            pnt2
          );
          pList.push(pnt);
        }
        pList.push(pnt2);
      }
      this.setCoordinates([pList]);
    }
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const ClosedCurve$1 = ClosedCurve;
class Polygon extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    this.type = PlotTypes.POLYGON;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    const count = this.getPointCount();
    if (count < 2) {
      return false;
    }
    this.setCoordinates([this.points]);
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const Polygon$1 = Polygon;
class FreePolygon extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    this.type = PlotTypes.FREE_POLYGON;
    this.freehand = true;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    this.setCoordinates([this.points]);
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const FreePolygon$1 = FreePolygon;
class AttackArrow extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    __publicField(this, "headWidthFactor");
    __publicField(this, "headHeightFactor");
    __publicField(this, "neckWidthFactor");
    __publicField(this, "neckHeightFactor");
    __publicField(this, "tailWidthFactor");
    __publicField(this, "headTailFactor");
    __publicField(this, "swallowTailFactor");
    __publicField(this, "swallowTailPnt");
    this.type = PlotTypes.ATTACK_ARROW;
    this.headHeightFactor = 0.18;
    this.headWidthFactor = 0.3;
    this.neckHeightFactor = 0.85;
    this.neckWidthFactor = 0.15;
    this.headTailFactor = 0.8;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    try {
      const points = this.getPointCount();
      if (points < 2) {
        return false;
      }
      if (points === 2) {
        this.setCoordinates([this.points]);
      } else {
        const pnts = this.getPoints();
        let [tailLeft, tailRight] = [pnts[0], pnts[1]];
        if (isClockWise(pnts[0], pnts[1], pnts[2])) {
          tailLeft = pnts[1];
          tailRight = pnts[0];
        }
        const midTail = Mid(tailLeft, tailRight);
        const bonePnts = [midTail].concat(pnts.slice(2));
        const headPnts = this.getArrowHeadPoints(bonePnts, tailLeft, tailRight);
        if (headPnts && headPnts.length > 4) {
          const [neckLeft, neckRight] = [headPnts[0], headPnts[4]];
          const tailWidthFactor = MathDistance(tailLeft, tailRight) / getBaseLength(bonePnts);
          const bodyPnts = this.getArrowBodyPoints(bonePnts, neckLeft, neckRight, tailWidthFactor);
          const count = bodyPnts.length;
          let leftPnts = [tailLeft].concat(bodyPnts.slice(0, count / 2));
          leftPnts.push(neckLeft);
          let rightPnts = [tailRight].concat(bodyPnts.slice(count / 2, count));
          rightPnts.push(neckRight);
          leftPnts = getQBSplinePoints(leftPnts);
          rightPnts = getQBSplinePoints(rightPnts);
          this.setCoordinates([leftPnts.concat(headPnts, rightPnts.reverse())]);
        }
      }
    } catch (e2) {
      console.log(e2);
    }
  }
  /**
   * 插值箭形上的点
   * @param pnt1
   * @param pnt2
   * @param pnt3
   * @param clockWise
   * @returns {Array.<T>}
   */
  getArrowPoints(pnt1, pnt2, pnt3, clockWise) {
    const midPnt = Mid(pnt1, pnt2);
    const len = MathDistance(midPnt, pnt3);
    let midPnt1 = getThirdPoint(pnt3, midPnt, 0, len * 0.3, true);
    let midPnt2 = getThirdPoint(pnt3, midPnt, 0, len * 0.5, true);
    midPnt1 = getThirdPoint(midPnt, midPnt1, HALF_PI, len / 5, clockWise);
    midPnt2 = getThirdPoint(midPnt, midPnt2, HALF_PI, len / 4, clockWise);
    const points = [midPnt, midPnt1, midPnt2, pnt3];
    const arrowPnts = this.getArrowHeadPoints(points);
    if (arrowPnts && Array.isArray(arrowPnts) && arrowPnts.length > 0) {
      const [neckLeftPoint, neckRightPoint] = [arrowPnts[0], arrowPnts[4]];
      const tailWidthFactor = MathDistance(pnt1, pnt2) / getBaseLength(points) / 2;
      const bodyPnts = this.getArrowBodyPoints(points, neckLeftPoint, neckRightPoint, tailWidthFactor);
      if (bodyPnts) {
        const n2 = bodyPnts.length;
        let lPoints = bodyPnts.slice(0, n2 / 2);
        let rPoints = bodyPnts.slice(n2 / 2, n2);
        lPoints.push(neckLeftPoint);
        rPoints.push(neckRightPoint);
        lPoints = lPoints.reverse();
        lPoints.push(pnt2);
        rPoints = rPoints.reverse();
        rPoints.push(pnt1);
        return lPoints.reverse().concat(arrowPnts, rPoints);
      }
    } else {
      throw new Error("插值出错");
    }
  }
  /**
   * 插值头部点
   * @param points
   * @param tailLeft
   * @param tailRight
   * @returns {[*,*,*,*,*]}
   */
  getArrowHeadPoints(points, tailLeft, tailRight) {
    try {
      let len = getBaseLength(points);
      let headHeight = len * this.headHeightFactor;
      const headPnt = points[points.length - 1];
      len = MathDistance(headPnt, points[points.length - 2]);
      let tailWidth = 0;
      if (tailLeft && tailRight) {
        tailWidth = MathDistance(tailLeft, tailRight);
      }
      if (headHeight > tailWidth * this.headTailFactor) {
        headHeight = tailWidth * this.headTailFactor;
      }
      const headWidth = headHeight * this.headWidthFactor;
      const neckWidth = headHeight * this.neckWidthFactor;
      headHeight = headHeight > len ? len : headHeight;
      const neckHeight = headHeight * this.neckHeightFactor;
      const headEndPnt = getThirdPoint(points[points.length - 2], headPnt, 0, headHeight, true);
      const neckEndPnt = getThirdPoint(points[points.length - 2], headPnt, 0, neckHeight, true);
      const headLeft = getThirdPoint(headPnt, headEndPnt, HALF_PI, headWidth, false);
      const headRight = getThirdPoint(headPnt, headEndPnt, HALF_PI, headWidth, true);
      const neckLeft = getThirdPoint(headPnt, neckEndPnt, HALF_PI, neckWidth, false);
      const neckRight = getThirdPoint(headPnt, neckEndPnt, HALF_PI, neckWidth, true);
      return [neckLeft, headLeft, headPnt, headRight, neckRight];
    } catch (e2) {
      console.log(e2);
    }
  }
  /**
   * 插值面部分数据
   * @param points
   * @param neckLeft
   * @param neckRight
   * @param tailWidthFactor
   * @returns {Array.<*>}
   */
  getArrowBodyPoints(points, neckLeft, neckRight, tailWidthFactor) {
    const allLen = wholeDistance(points);
    const len = getBaseLength(points);
    const tailWidth = len * tailWidthFactor;
    const neckWidth = MathDistance(neckLeft, neckRight);
    const widthDif = (tailWidth - neckWidth) / 2;
    let tempLen = 0;
    const leftBodyPnts = [];
    const rightBodyPnts = [];
    for (let i = 1; i < points.length - 1; i++) {
      const angle = getAngleOfThreePoints(points[i - 1], points[i], points[i + 1]) / 2;
      tempLen += MathDistance(points[i - 1], points[i]);
      const w = (tailWidth / 2 - tempLen / allLen * widthDif) / Math.sin(angle);
      const left = getThirdPoint(points[i - 1], points[i], Math.PI - angle, w, true);
      const right = getThirdPoint(points[i - 1], points[i], angle, w, false);
      leftBodyPnts.push(left);
      rightBodyPnts.push(right);
    }
    return leftBodyPnts.concat(rightBodyPnts);
  }
  /**
   * 获取对称点
   * @param linePnt1
   * @param linePnt2
   * @param point
   * @returns {*}
   */
  getTempPoint4(linePnt1, linePnt2, point) {
    try {
      const midPnt = Mid(linePnt1, linePnt2);
      const len = MathDistance(midPnt, point);
      const angle = getAngleOfThreePoints(linePnt1, midPnt, point);
      let symPnt;
      let distance1 = 0;
      let distance2 = 0;
      let mid;
      if (angle < HALF_PI) {
        distance1 = len * Math.sin(angle);
        distance2 = len * Math.cos(angle);
        mid = getThirdPoint(linePnt1, midPnt, HALF_PI, distance1, false);
        symPnt = getThirdPoint(midPnt, mid, HALF_PI, distance2, true);
      } else if (angle >= HALF_PI && angle < Math.PI) {
        distance1 = len * Math.sin(Math.PI - angle);
        distance2 = len * Math.cos(Math.PI - angle);
        mid = getThirdPoint(linePnt1, midPnt, HALF_PI, distance1, false);
        symPnt = getThirdPoint(midPnt, mid, HALF_PI, distance2, false);
      } else if (angle >= Math.PI && angle < Math.PI * 1.5) {
        distance1 = len * Math.sin(angle - Math.PI);
        distance2 = len * Math.cos(angle - Math.PI);
        mid = getThirdPoint(linePnt1, midPnt, HALF_PI, distance1, true);
        symPnt = getThirdPoint(midPnt, mid, HALF_PI, distance2, true);
      } else {
        distance1 = len * Math.sin(Math.PI * 2 - angle);
        distance2 = len * Math.cos(Math.PI * 2 - angle);
        mid = getThirdPoint(linePnt1, midPnt, HALF_PI, distance1, true);
        symPnt = getThirdPoint(midPnt, mid, HALF_PI, distance2, false);
      }
      return symPnt;
    } catch (e2) {
      console.log(e2);
    }
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {ol.Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const AttackArrow$1 = AttackArrow;
class DoubleArrow extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    __publicField(this, "neckHeightFactor");
    __publicField(this, "headHeightFactor");
    __publicField(this, "headWidthFactor");
    __publicField(this, "neckWidthFactor");
    __publicField(this, "connPoint");
    __publicField(this, "tempPoint4");
    this.type = PlotTypes.DOUBLE_ARROW;
    this.headHeightFactor = 0.25;
    this.headWidthFactor = 0.3;
    this.neckHeightFactor = 0.85;
    this.neckWidthFactor = 0.15;
    this.connPoint = null;
    this.tempPoint4 = null;
    this.fixPointCount = 4;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    try {
      const count = this.getPointCount();
      if (count < 2) {
        return false;
      }
      if (count === 2) {
        this.setCoordinates([this.points]);
        return false;
      }
      if (count > 2) {
        const [pnt1, pnt2, pnt3] = [this.points[0], this.points[1], this.points[2]];
        if (count === 3) {
          this.tempPoint4 = this.getTempPoint4(pnt1, pnt2, pnt3);
          this.connPoint = Mid(pnt1, pnt2);
        } else if (count === 4) {
          this.tempPoint4 = this.points[3];
          this.connPoint = Mid(pnt1, pnt2);
        } else {
          this.tempPoint4 = this.points[3];
          this.connPoint = this.points[4];
        }
        let leftArrowPnts;
        let rightArrowPnts;
        if (isClockWise(pnt1, pnt2, pnt3)) {
          leftArrowPnts = this.getArrowPoints(pnt1, this.connPoint, this.tempPoint4, false);
          rightArrowPnts = this.getArrowPoints(this.connPoint, pnt2, pnt3, true);
        } else {
          leftArrowPnts = this.getArrowPoints(pnt2, this.connPoint, pnt3, false);
          rightArrowPnts = this.getArrowPoints(this.connPoint, pnt1, this.tempPoint4, true);
        }
        const m = leftArrowPnts.length;
        const t2 = (m - 5) / 2;
        const llBodyPnts = leftArrowPnts.slice(0, t2);
        const lArrowPnts = leftArrowPnts.slice(t2, t2 + 5);
        let lrBodyPnts = leftArrowPnts.slice(t2 + 5, m);
        let rlBodyPnts = rightArrowPnts.slice(0, t2);
        const rArrowPnts = rightArrowPnts.slice(t2, t2 + 5);
        const rrBodyPnts = rightArrowPnts.slice(t2 + 5, m);
        rlBodyPnts = getBezierPoints(rlBodyPnts);
        const bodyPnts = getBezierPoints(rrBodyPnts.concat(llBodyPnts.slice(1)));
        lrBodyPnts = getBezierPoints(lrBodyPnts);
        const pnts = rlBodyPnts.concat(rArrowPnts, bodyPnts, lArrowPnts, lrBodyPnts);
        this.setCoordinates([pnts]);
      }
    } catch (e2) {
      console.log(e2);
    }
  }
  /**
   * 插值箭形上的点
   * @param pnt1
   * @param pnt2
   * @param pnt3
   * @param clockWise
   * @returns {Array.<T>}
   */
  getArrowPoints(pnt1, pnt2, pnt3, clockWise) {
    const midPnt = Mid(pnt1, pnt2);
    const len = MathDistance(midPnt, pnt3);
    let midPnt1 = getThirdPoint(pnt3, midPnt, 0, len * 0.3, true);
    let midPnt2 = getThirdPoint(pnt3, midPnt, 0, len * 0.5, true);
    midPnt1 = getThirdPoint(midPnt, midPnt1, HALF_PI, len / 5, clockWise);
    midPnt2 = getThirdPoint(midPnt, midPnt2, HALF_PI, len / 4, clockWise);
    const points = [midPnt, midPnt1, midPnt2, pnt3];
    const arrowPnts = this.getArrowHeadPoints(points);
    if (arrowPnts && Array.isArray(arrowPnts) && arrowPnts.length > 0) {
      const [neckLeftPoint, neckRightPoint] = [arrowPnts[0], arrowPnts[4]];
      const tailWidthFactor = MathDistance(pnt1, pnt2) / getBaseLength(points) / 2;
      const bodyPnts = this.getArrowBodyPoints(points, neckLeftPoint, neckRightPoint, tailWidthFactor);
      if (bodyPnts) {
        const n2 = bodyPnts.length;
        let lPoints = bodyPnts.slice(0, n2 / 2);
        let rPoints = bodyPnts.slice(n2 / 2, n2);
        lPoints.push(neckLeftPoint);
        rPoints.push(neckRightPoint);
        lPoints = lPoints.reverse();
        lPoints.push(pnt2);
        rPoints = rPoints.reverse();
        rPoints.push(pnt1);
        return lPoints.reverse().concat(arrowPnts, rPoints);
      }
    } else {
      throw new Error("插值出错");
    }
  }
  /**
   * 插值头部点
   * @param points
   * @returns {[*,*,*,*,*]}
   */
  getArrowHeadPoints(points) {
    try {
      const len = getBaseLength(points);
      const headHeight = len * this.headHeightFactor;
      const headPnt = points[points.length - 1];
      const headWidth = headHeight * this.headWidthFactor;
      const neckWidth = headHeight * this.neckWidthFactor;
      const neckHeight = headHeight * this.neckHeightFactor;
      const headEndPnt = getThirdPoint(points[points.length - 2], headPnt, 0, headHeight, true);
      const neckEndPnt = getThirdPoint(points[points.length - 2], headPnt, 0, neckHeight, true);
      const headLeft = getThirdPoint(headPnt, headEndPnt, HALF_PI, headWidth, false);
      const headRight = getThirdPoint(headPnt, headEndPnt, HALF_PI, headWidth, true);
      const neckLeft = getThirdPoint(headPnt, neckEndPnt, HALF_PI, neckWidth, false);
      const neckRight = getThirdPoint(headPnt, neckEndPnt, HALF_PI, neckWidth, true);
      return [neckLeft, headLeft, headPnt, headRight, neckRight];
    } catch (e2) {
      console.log(e2);
    }
  }
  /**
   * 插值面部分数据
   * @param points
   * @param neckLeft
   * @param neckRight
   * @param tailWidthFactor
   * @returns {Array.<*>}
   */
  getArrowBodyPoints(points, neckLeft, neckRight, tailWidthFactor) {
    const allLen = wholeDistance(points);
    const len = getBaseLength(points);
    const tailWidth = len * tailWidthFactor;
    const neckWidth = MathDistance(neckLeft, neckRight);
    const widthDif = (tailWidth - neckWidth) / 2;
    let tempLen = 0;
    const leftBodyPnts = [];
    const rightBodyPnts = [];
    for (let i = 1; i < points.length - 1; i++) {
      const angle = getAngleOfThreePoints(points[i - 1], points[i], points[i + 1]) / 2;
      tempLen += MathDistance(points[i - 1], points[i]);
      const w = (tailWidth / 2 - tempLen / allLen * widthDif) / Math.sin(angle);
      const left = getThirdPoint(points[i - 1], points[i], Math.PI - angle, w, true);
      const right = getThirdPoint(points[i - 1], points[i], angle, w, false);
      leftBodyPnts.push(left);
      rightBodyPnts.push(right);
    }
    return leftBodyPnts.concat(rightBodyPnts);
  }
  /**
   * 获取对称点
   * @param linePnt1
   * @param linePnt2
   * @param point
   * @returns {*}
   */
  getTempPoint4(linePnt1, linePnt2, point) {
    try {
      const midPnt = Mid(linePnt1, linePnt2);
      const len = MathDistance(midPnt, point);
      const angle = getAngleOfThreePoints(linePnt1, midPnt, point);
      let symPnt;
      let distance1 = 0;
      let distance2 = 0;
      let mid;
      if (angle < HALF_PI) {
        distance1 = len * Math.sin(angle);
        distance2 = len * Math.cos(angle);
        mid = getThirdPoint(linePnt1, midPnt, HALF_PI, distance1, false);
        symPnt = getThirdPoint(midPnt, mid, HALF_PI, distance2, true);
      } else if (angle >= HALF_PI && angle < Math.PI) {
        distance1 = len * Math.sin(Math.PI - angle);
        distance2 = len * Math.cos(Math.PI - angle);
        mid = getThirdPoint(linePnt1, midPnt, HALF_PI, distance1, false);
        symPnt = getThirdPoint(midPnt, mid, HALF_PI, distance2, false);
      } else if (angle >= Math.PI && angle < Math.PI * 1.5) {
        distance1 = len * Math.sin(angle - Math.PI);
        distance2 = len * Math.cos(angle - Math.PI);
        mid = getThirdPoint(linePnt1, midPnt, HALF_PI, distance1, true);
        symPnt = getThirdPoint(midPnt, mid, HALF_PI, distance2, true);
      } else {
        distance1 = len * Math.sin(Math.PI * 2 - angle);
        distance2 = len * Math.cos(Math.PI * 2 - angle);
        mid = getThirdPoint(linePnt1, midPnt, HALF_PI, distance1, true);
        symPnt = getThirdPoint(midPnt, mid, HALF_PI, distance2, false);
      }
      return symPnt;
    } catch (e2) {
      console.log(e2);
    }
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
    if (this.getPointCount() === 3 && this.tempPoint4 !== null) {
      this.points.push(this.tempPoint4);
    }
    if (this.connPoint !== null) {
      this.points.push(this.connPoint);
    }
  }
}
const DoubleArrow$1 = DoubleArrow;
class StraightArrow extends LineString {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    __publicField(this, "maxArrowLength");
    __publicField(this, "arrowLengthScale");
    this.type = PlotTypes.STRAIGHT_ARROW;
    this.fixPointCount = 2;
    this.maxArrowLength = 3e6;
    this.arrowLengthScale = 5;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    try {
      const count = this.getPointCount();
      if (count < 2) {
        return false;
      }
      const pnts = this.getPoints();
      const [pnt1, pnt2] = [pnts[0], pnts[1]];
      const distance = MathDistance(pnt1, pnt2);
      let len = distance / this.arrowLengthScale;
      len = len > this.maxArrowLength ? this.maxArrowLength : len;
      const leftPnt = getThirdPoint(pnt1, pnt2, Math.PI / 6, len, false);
      const rightPnt = getThirdPoint(pnt1, pnt2, Math.PI / 6, len, true);
      this.setCoordinates([pnt1, pnt2, leftPnt, pnt2, rightPnt]);
    } catch (e2) {
      console.log(e2);
    }
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {{}|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const StraightArrow$1 = StraightArrow;
class FineArrow extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    __publicField(this, "neckAngle");
    __publicField(this, "headAngle");
    __publicField(this, "headWidthFactor");
    __publicField(this, "neckWidthFactor");
    __publicField(this, "tailWidthFactor");
    this.type = PlotTypes.FINE_ARROW;
    this.tailWidthFactor = 0.1;
    this.neckWidthFactor = 0.2;
    this.headWidthFactor = 0.25;
    this.headAngle = Math.PI / 8.5;
    this.neckAngle = Math.PI / 13;
    this.fixPointCount = 2;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    try {
      const cont = this.getPointCount();
      if (cont < 2) {
        return false;
      }
      const pnts = this.getPoints();
      const [pnt1, pnt2] = [pnts[0], pnts[1]];
      const len = getBaseLength(pnts);
      const tailWidth = len * this.tailWidthFactor;
      const neckWidth = len * this.neckWidthFactor;
      const headWidth = len * this.headWidthFactor;
      const tailLeft = getThirdPoint(pnt2, pnt1, HALF_PI, tailWidth, true);
      const tailRight = getThirdPoint(pnt2, pnt1, HALF_PI, tailWidth, false);
      const headLeft = getThirdPoint(pnt1, pnt2, this.headAngle, headWidth, false);
      const headRight = getThirdPoint(pnt1, pnt2, this.headAngle, headWidth, true);
      const neckLeft = getThirdPoint(pnt1, pnt2, this.neckAngle, neckWidth, false);
      const neckRight = getThirdPoint(pnt1, pnt2, this.neckAngle, neckWidth, true);
      const pList = [tailLeft, neckLeft, headLeft, pnt2, headRight, neckRight, tailRight];
      this.setCoordinates([pList]);
    } catch (e2) {
      console.log(e2);
    }
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const FineArrow$1 = FineArrow;
class AssaultDirection extends FineArrow$1 {
  constructor(coordinates, points, params) {
    super(coordinates, points, params);
    this.tailWidthFactor = 0.05;
    this.neckWidthFactor = 0.1;
    this.headWidthFactor = 0.15;
    this.type = PlotTypes.ASSAULT_DIRECTION;
    this.headAngle = Math.PI / 4;
    this.neckAngle = Math.PI * 0.17741;
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
    this.set("params", params);
  }
}
const AssaultDirection$1 = AssaultDirection;
class TailedAttackArrow extends AttackArrow$1 {
  constructor(coordinates, points, params) {
    super(coordinates, points, params);
    this.type = PlotTypes.TAILED_ATTACK_ARROW;
    this.headHeightFactor = 0.18;
    this.headWidthFactor = 0.3;
    this.neckHeightFactor = 0.85;
    this.neckWidthFactor = 0.15;
    this.tailWidthFactor = 0.1;
    this.headTailFactor = 0.8;
    this.swallowTailFactor = 1;
    this.swallowTailPnt = null;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 执行动作
   */
  generate() {
    try {
      const points = this.getPointCount();
      if (points < 2) {
        return false;
      }
      if (points === 2) {
        this.setCoordinates([this.points]);
        return false;
      }
      const pnts = this.getPoints();
      let [tailLeft, tailRight] = [pnts[0], pnts[1]];
      if (isClockWise(pnts[0], pnts[1], pnts[2])) {
        tailLeft = pnts[1];
        tailRight = pnts[0];
      }
      const midTail = Mid(tailLeft, tailRight);
      const bonePnts = [midTail].concat(pnts.slice(2));
      const headPnts = this.getArrowHeadPoints(bonePnts, tailLeft, tailRight);
      if (headPnts && headPnts.length > 4) {
        const [neckLeft, neckRight] = [headPnts[0], headPnts[4]];
        const tailWidth = MathDistance(tailLeft, tailRight);
        const allLen = getBaseLength(bonePnts);
        const len = allLen * this.tailWidthFactor * this.swallowTailFactor;
        this.swallowTailPnt = getThirdPoint(bonePnts[1], bonePnts[0], 0, len, true);
        const factor = tailWidth / allLen;
        const bodyPnts = this.getArrowBodyPoints(bonePnts, neckLeft, neckRight, factor);
        const count = bodyPnts.length;
        let leftPnts = [tailLeft].concat(bodyPnts.slice(0, count / 2));
        leftPnts.push(neckLeft);
        let rightPnts = [tailRight].concat(bodyPnts.slice(count / 2, count));
        rightPnts.push(neckRight);
        leftPnts = getQBSplinePoints(leftPnts);
        rightPnts = getQBSplinePoints(rightPnts);
        this.setCoordinates([leftPnts.concat(headPnts, rightPnts.reverse(), [this.swallowTailPnt, leftPnts[0]])]);
      }
    } catch (e2) {
      console.log(e2);
    }
  }
}
const TailedAttackArrow$1 = TailedAttackArrow;
class SquadCombat extends AttackArrow$1 {
  constructor(coordinates, points, params) {
    super(coordinates, points, params);
    this.type = PlotTypes.SQUAD_COMBAT;
    this.headHeightFactor = 0.18;
    this.headWidthFactor = 0.3;
    this.neckHeightFactor = 0.85;
    this.neckWidthFactor = 0.15;
    this.tailWidthFactor = 0.1;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 执行动作
   */
  generate() {
    try {
      const count = this.getPointCount();
      if (count < 2) {
        return false;
      } else {
        const pnts = this.getPoints();
        const tailPnts = this.getTailPoints(pnts);
        const headPnts = this.getArrowHeadPoints(pnts, tailPnts[0], tailPnts[1]);
        if (headPnts && headPnts.length > 4) {
          const neckLeft = headPnts[0];
          const neckRight = headPnts[4];
          const bodyPnts = this.getArrowBodyPoints(pnts, neckLeft, neckRight, this.tailWidthFactor);
          const count2 = bodyPnts.length;
          let leftPnts = [tailPnts[0]].concat(bodyPnts.slice(0, count2 / 2));
          leftPnts.push(neckLeft);
          let rightPnts = [tailPnts[1]].concat(bodyPnts.slice(count2 / 2, count2));
          rightPnts.push(neckRight);
          leftPnts = getQBSplinePoints(leftPnts);
          rightPnts = getQBSplinePoints(rightPnts);
          this.setCoordinates([leftPnts.concat(headPnts, rightPnts.reverse())]);
        }
      }
    } catch (e2) {
      console.log(e2);
    }
  }
  getTailPoints(points) {
    const allLen = getBaseLength(points);
    const tailWidth = allLen * this.tailWidthFactor;
    const tailLeft = getThirdPoint(points[1], points[0], HALF_PI, tailWidth, false);
    const tailRight = getThirdPoint(points[1], points[0], HALF_PI, tailWidth, true);
    return [tailLeft, tailRight];
  }
}
const SquadCombat$1 = SquadCombat;
class TailedSquadCombat extends AttackArrow$1 {
  constructor(coordinates, points, params) {
    super(coordinates, points, params);
    this.type = PlotTypes.TAILED_SQUAD_COMBAT;
    this.headHeightFactor = 0.18;
    this.headWidthFactor = 0.3;
    this.neckHeightFactor = 0.85;
    this.neckWidthFactor = 0.15;
    this.tailWidthFactor = 0.1;
    this.swallowTailFactor = 1;
    this.swallowTailPnt = null;
    this.fixPointCount = 2;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 执行动作
   */
  generate() {
    try {
      const count = this.getPointCount();
      if (count < 2) {
        return false;
      } else {
        const pnts = this.getPoints();
        const tailPnts = this.getTailPoints(pnts);
        const headPnts = this.getArrowHeadPoints(pnts, tailPnts[0], tailPnts[2]);
        if (headPnts && headPnts.length > 4) {
          const neckLeft = headPnts[0];
          const neckRight = headPnts[4];
          const bodyPnts = this.getArrowBodyPoints(pnts, neckLeft, neckRight, this.tailWidthFactor);
          const count2 = bodyPnts.length;
          let leftPnts = [tailPnts[0]].concat(bodyPnts.slice(0, count2 / 2));
          leftPnts.push(neckLeft);
          let rightPnts = [tailPnts[2]].concat(bodyPnts.slice(count2 / 2, count2));
          rightPnts.push(neckRight);
          leftPnts = getQBSplinePoints(leftPnts);
          rightPnts = getQBSplinePoints(rightPnts);
          this.setCoordinates([leftPnts.concat(headPnts, rightPnts.reverse(), [tailPnts[1], leftPnts[0]])]);
        }
      }
    } catch (e2) {
      console.log(e2);
    }
  }
  getTailPoints(points) {
    const allLen = getBaseLength(points);
    const tailWidth = allLen * this.tailWidthFactor;
    const tailLeft = getThirdPoint(points[1], points[0], HALF_PI, tailWidth, false);
    const tailRight = getThirdPoint(points[1], points[0], HALF_PI, tailWidth, true);
    const len = tailWidth * this.swallowTailFactor;
    const swallowTailPnt = getThirdPoint(points[1], points[0], 0, len, true);
    return [tailLeft, swallowTailPnt, tailRight];
  }
}
const TailedSquadCombat$1 = TailedSquadCombat;
class GatheringPlace extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    __publicField(this, "t");
    this.type = PlotTypes.GATHERING_PLACE;
    this.t = 0.4;
    this.fixPointCount = 3;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    let pnts = this.getPoints();
    const points = this.getPointCount();
    if (pnts.length < 2) {
      return false;
    }
    if (points === 2) {
      const mid2 = Mid(pnts[0], pnts[1]);
      const d = MathDistance(pnts[0], mid2) / 0.9;
      const pnt = getThirdPoint(pnts[0], mid2, HALF_PI, d, true);
      pnts = [pnts[0], pnt, pnts[1]];
    }
    const mid = Mid(pnts[0], pnts[2]);
    pnts.push(mid, pnts[0], pnts[1]);
    let normals = [];
    let pnt1, pnt2, pnt3;
    const pList = [];
    for (let i = 0; i < pnts.length - 2; i++) {
      pnt1 = pnts[i];
      pnt2 = pnts[i + 1];
      pnt3 = pnts[i + 2];
      const normalPoints = getBisectorNormals(this.t, pnt1, pnt2, pnt3);
      normals = normals.concat(normalPoints);
    }
    const count = normals.length;
    normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
    for (let i = 0; i < pnts.length - 2; i++) {
      pnt1 = pnts[i];
      pnt2 = pnts[i + 1];
      pList.push(pnt1);
      for (let t2 = 0; t2 <= FITTING_COUNT; t2++) {
        const pnt = getCubicValue(
          t2 / FITTING_COUNT,
          pnt1,
          normals[i * 2],
          normals[i * 2 + 1],
          pnt2
        );
        pList.push(pnt);
      }
      pList.push(pnt2);
    }
    this.setCoordinates([pList]);
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const GatheringPlace$1 = GatheringPlace;
class RectFlag extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    this.type = PlotTypes.RECTFLAG;
    this.fixPointCount = 2;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    const count = this.getPointCount();
    if (count < 2) {
      return false;
    }
    this.setCoordinates([this.calculatePonits(this.points)]);
  }
  /**
   * 插值点数据
   * @param points
   * @returns {Array}
   */
  calculatePonits(points) {
    let components = [];
    if (points.length > 1) {
      const startPoint = points[0];
      const endPoint = points[points.length - 1];
      const point1 = [endPoint[0], startPoint[1]];
      const point2 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
      const point3 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
      const point4 = [startPoint[0], endPoint[1]];
      components = [startPoint, point1, point2, point3, point4];
    }
    return components;
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const RectFlag$1 = RectFlag;
class TriangleFlag extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    this.type = PlotTypes.TRIANGLEFLAG;
    this.fixPointCount = 2;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    const count = this.getPointCount();
    if (count < 2) {
      return false;
    }
    this.setCoordinates([this.calculatePonits(this.points)]);
  }
  /**
   * 插值点数据
   * @param points
   * @returns {Array}
   */
  calculatePonits(points) {
    let components = [];
    if (points.length > 1) {
      const startPoint = points[0];
      const endPoint = points[points.length - 1];
      const point1 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
      const point2 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
      const point3 = [startPoint[0], endPoint[1]];
      components = [startPoint, point1, point2, point3];
    }
    return components;
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const TriangleFlag$1 = TriangleFlag;
class CurveFlag extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    this.type = PlotTypes.CURVEFLAG;
    this.fixPointCount = 2;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    const count = this.getPointCount();
    if (count < 2) {
      return false;
    }
    this.setCoordinates([this.calculatePonits(this.points)]);
  }
  /**
   * 插值点数据
   * @param points
   * @returns {Array}
   */
  calculatePonits(points) {
    let components = [];
    if (points.length > 1) {
      const startPoint = points[0];
      const endPoint = points[points.length - 1];
      const point1 = startPoint;
      const point2 = [
        (endPoint[0] - startPoint[0]) / 4 + startPoint[0],
        (endPoint[1] - startPoint[1]) / 8 + startPoint[1]
      ];
      const point3 = [(startPoint[0] + endPoint[0]) / 2, startPoint[1]];
      const point4 = [
        (endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0],
        -(endPoint[1] - startPoint[1]) / 8 + startPoint[1]
      ];
      const point5 = [endPoint[0], startPoint[1]];
      const point6 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
      const point7 = [
        (endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0],
        (endPoint[1] - startPoint[1]) * 3 / 8 + startPoint[1]
      ];
      const point8 = [(startPoint[0] + endPoint[0]) / 2, (startPoint[1] + endPoint[1]) / 2];
      const point9 = [
        (endPoint[0] - startPoint[0]) / 4 + startPoint[0],
        (endPoint[1] - startPoint[1]) * 5 / 8 + startPoint[1]
      ];
      const point10 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
      const point11 = [startPoint[0], endPoint[1]];
      const curve1 = getBezierPoints([point1, point2, point3, point4, point5]);
      const curve2 = getBezierPoints([point6, point7, point8, point9, point10]);
      components = curve1.concat(curve2);
      components.push(point11);
    }
    return components;
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const CurveFlag$1 = CurveFlag;
let Rectinclined$2 = class Rectinclined extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    this.type = PlotTypes.RECTINCLINED1;
    this.fixPointCount = 3;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    const points = this.getPointCount();
    if (points < 2) {
      return false;
    }
    if (points === 2) {
      this.setCoordinates([this.points]);
    } else {
      const pnts = this.getPoints();
      const [pnt1, pnt2, mouse] = [pnts[0], pnts[1], pnts[2]];
      const d = this.calculatePerpendicularDistance(pnt1, pnt2, mouse);
      const direction = this.calculatePositionRelativeToLine(pnt1, pnt2, mouse);
      const pnt3 = this.calculatePerpendicularPoint(pnt1, pnt2, direction * d);
      const pnt4 = this.calculateFourthPoint(pnt1, pnt2, pnt3);
      const pList = [];
      pList.push(pnt1, pnt2, pnt3, pnt4, pnt1);
      this.setCoordinates([pList]);
    }
  }
  /**
   * 已知p1，p2，p3三点，计算p3到p1p2的垂直距离
   * @param {*} p1
   * @param {*} p2
   * @param {*} p3
   */
  calculatePerpendicularDistance(p1, p2, p3) {
    const vx = p2[0] - p1[0];
    const vy = p2[1] - p1[1];
    const px = p3[0] - p1[0];
    const py = p3[1] - p1[1];
    const vMagnitude = Math.sqrt(vx * vx + vy * vy);
    const dotProduct = px * vx + py * vy;
    const projectionLength = dotProduct / vMagnitude;
    const pMagnitude = Math.sqrt(px * px + py * py);
    const perpendicularDistance = Math.sqrt(pMagnitude * pMagnitude - projectionLength * projectionLength);
    return perpendicularDistance;
  }
  /**
   * 已知p1，p2，两点，判断p3点在p1p2的左右，返回-1右侧，0线上，1左侧
   * @param {*} p1
   * @param {*} p2
   * @param {*} p3
   */
  calculatePositionRelativeToLine(p1, p2, p3) {
    const v1 = {
      x: p2[0] - p1[0],
      y: p2[1] - p1[1]
    };
    const v2 = {
      x: p3[0] - p1[0],
      y: p3[1] - p1[1]
    };
    const crossProduct = v1.x * v2.y - v1.y * v2.x;
    const direction = crossProduct > 0 ? 1 : -1;
    if (p1[1] > p2[1]) {
      return direction;
    }
    return -direction;
  }
  /**
   * 已知p1，p2，p3点求矩形的p4点
   * @param {*} p1
   * @param {*} p2
   * @param {*} p3
   */
  calculateFourthPoint(p1, p2, p3) {
    const x = p1[0] + p3[0] - p2[0];
    const y = p1[1] + p3[1] - p2[1];
    return [x, y];
  }
  /**
   * 已知p1，p2两点和距离d，求距离p1p2垂直距离为d的点p3
   * @param {*} p1
   * @param {*} p2
   * @param {*} d
   */
  calculatePerpendicularPoint(p1, p2, d) {
    const m = (p2[1] - p1[1]) / (p2[0] - p1[0]);
    let x, y;
    if (m !== 0) {
      const perpendicularSlope = -1 / m;
      const c = p2[1] - perpendicularSlope * p2[0];
      x = d * Math.sqrt(1 / (1 + perpendicularSlope ** 2)) + p2[0];
      y = perpendicularSlope * x + c;
    } else {
      x = p2[0];
      y = p2[1] - d;
    }
    return [x, y];
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {ol.Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
};
const Rectinclined$3 = Rectinclined$2;
class Rectinclined2 extends Polygon$2 {
  constructor(coordinates, points, params) {
    super([]);
    __publicField(this, "type");
    __publicField(this, "fixPointCount");
    __publicField(this, "map");
    __publicField(this, "points");
    __publicField(this, "freehand");
    this.type = PlotTypes.RECTINCLINED2;
    this.fixPointCount = 3;
    this.set("params", params);
    if (points && points.length > 0) {
      this.setPoints(points);
    } else if (coordinates && coordinates.length > 0) {
      this.setCoordinates(coordinates);
    }
  }
  /**
   * 获取标绘类型
   * @returns {*}
   */
  getPlotType() {
    return this.type;
  }
  /**
   * 执行动作
   */
  generate() {
    const points = this.getPointCount();
    if (points < 2) {
      return false;
    }
    if (points === 2) {
      this.setCoordinates([this.points]);
    } else {
      const pnts = this.getPoints();
      const [pnt1, pnt2, mouse] = [pnts[0], pnts[1], pnts[2]];
      const intersect = this.calculateIntersectionPoint(pnt1, pnt2, mouse);
      const pnt4 = this.calculateFourthPoint(pnt1, intersect, mouse);
      const pList = [];
      pList.push(pnt1, intersect, mouse, pnt4, pnt1);
      this.setCoordinates([pList]);
    }
  }
  /**
   * 已知p1，p2，p3点求矩形的p4点
   * @param {*} p1
   * @param {*} p2
   * @param {*} p3
   */
  calculateFourthPoint(p1, p2, p3) {
    const x = p1[0] + p3[0] - p2[0];
    const y = p1[1] + p3[1] - p2[1];
    return [x, y];
  }
  /**
   * 已知p1点和p2点，求p3点到p1p2垂线的交点
   * @param {*} p1
   * @param {*} p2
   * @param {*} p3
   */
  calculateIntersectionPoint(p1, p2, p3) {
    const v = {
      x: p2[0] - p1[0],
      y: p2[1] - p1[1]
    };
    const u = {
      x: p3[0] - p1[0],
      y: p3[1] - p1[1]
    };
    const projectionLength = (u.x * v.x + u.y * v.y) / (v.x * v.x + v.y * v.y);
    const intersectionPoint = {
      x: p1[0] + v.x * projectionLength,
      y: p1[1] + v.y * projectionLength
    };
    return [intersectionPoint.x, intersectionPoint.y];
  }
  /**
   * 设置地图对象
   * @param map
   */
  setMap(map) {
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
  }
  /**
   * 获取当前地图对象
   * @returns {ol.Map|*}
   */
  getMap() {
    return this.map;
  }
  /**
   * 判断是否是Plot
   * @returns {boolean}
   */
  isPlot() {
    return true;
  }
  /**
   * 设置坐标点
   * @param value
   */
  setPoints(value) {
    this.points = !value ? [] : value;
    if (this.points.length >= 1) {
      this.generate();
    }
  }
  /**
   * 获取坐标点
   * @returns {Array.<T>}
   */
  getPoints() {
    return this.points.slice(0);
  }
  /**
   * 获取点数量
   * @returns {Number}
   */
  getPointCount() {
    return this.points.length;
  }
  /**
   * 更新当前坐标
   * @param point
   * @param index
   */
  updatePoint(point, index2) {
    if (index2 >= 0 && index2 < this.points.length) {
      this.points[index2] = point;
      this.generate();
    }
  }
  /**
   * 更新最后一个坐标
   * @param point
   */
  updateLastPoint(point) {
    this.updatePoint(point, this.points.length - 1);
  }
  /**
   * 结束绘制
   */
  finishDrawing() {
  }
}
const Rectinclined$1 = Rectinclined2;
const Geometry = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  Arc: Arc$1,
  AssaultDirection: AssaultDirection$1,
  AttackArrow: AttackArrow$1,
  Circle: Circle$1,
  ClosedCurve: ClosedCurve$1,
  Curve: Curve$1,
  CurveFlag: CurveFlag$1,
  DoubleArrow: DoubleArrow$1,
  Ellipse: Ellipse$1,
  FineArrow: FineArrow$1,
  FreeHandLine: FreeHandLine$1,
  FreePolygon: FreePolygon$1,
  GatheringPlace: GatheringPlace$1,
  Lune: Lune$1,
  Pennant: Pennant$1,
  PlotTextBox: PlotTextBox$1,
  Point: Point$1,
  Polygon: Polygon$1,
  Polyline: Polyline$1,
  RectAngle: RectAngle$1,
  RectFlag: RectFlag$1,
  RectInclined1: Rectinclined$3,
  RectInclined2: Rectinclined$1,
  Sector: Sector$1,
  SquadCombat: SquadCombat$1,
  StraightArrow: StraightArrow$1,
  TailedAttackArrow: TailedAttackArrow$1,
  TailedSquadCombat: TailedSquadCombat$1,
  TriangleFlag: TriangleFlag$1
}, Symbol.toStringTag, { value: "Module" }));
class PlotDraw extends Observable {
  constructor(map, params, ctx) {
    super();
    __publicField(this, "map");
    __publicField(this, "ctx");
    __publicField(this, "options");
    __publicField(this, "feature");
    __publicField(this, "points");
    __publicField(this, "plotType");
    __publicField(this, "plotParams");
    __publicField(this, "mapViewport");
    __publicField(this, "layerName");
    __publicField(this, "drawLayer");
    __publicField(this, "plot");
    __publicField(this, "drawInteraction_");
    __publicField(this, "dblClickZoomInteraction");
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
    this.ctx = ctx;
    this.options = params || {};
    this.points = [];
    this.plot = null;
    this.feature = null;
    this.plotType = null;
    this.plotParams = null;
    this.mapViewport = this.map.getViewport();
    this.dblClickZoomInteraction = null;
    this.drawInteraction_ = null;
    this.layerName = this.options && this.options.layerName ? this.options.layerName : BASE_LAYERNAME;
    bindAll(
      [
        "textAreaDrawStart",
        "textAreaDrawEnd",
        "mapFirstClickHandler",
        "mapNextClickHandler",
        "mapDoubleClickHandler",
        "mapMouseMoveHandler"
      ],
      this
    );
    this.drawLayer = createVectorLayer(this.map, this.layerName, {
      create: true
    });
    this.drawLayer.setZIndex(this.options.zIndex || 99);
  }
  /**
   * 创建Plot
   * @param type
   * @param points
   * @param _params
   * @returns {*}
   */
  createPlot(type, points, _params) {
    const params = _params || {};
    switch (type) {
      case PlotTypes.TEXTAREA:
        return null;
      case PlotTypes.POINT:
        return new Point$1([], points, params);
      case PlotTypes.PENNANT:
        return new Pennant$1([], points, params);
      case PlotTypes.POLYLINE:
        return new Polyline$1([], points, params);
      case PlotTypes.ARC:
        return new Arc$1([], points, params);
      case PlotTypes.CIRCLE:
        return new Circle$1([], points, params);
      case PlotTypes.CURVE:
        return new Curve$1([], points, params);
      case PlotTypes.FREEHANDLINE:
        return new FreeHandLine$1([], points, params);
      case PlotTypes.RECTANGLE:
        return new RectAngle$1([], points, params);
      case PlotTypes.ELLIPSE:
        return new Ellipse$1([], points, params);
      case PlotTypes.LUNE:
        return new Lune$1([], points, params);
      case PlotTypes.SECTOR:
        return new Sector$1([], points, params);
      case PlotTypes.CLOSED_CURVE:
        return new ClosedCurve$1([], points, params);
      case PlotTypes.POLYGON:
        return new Polygon$1([], points, params);
      case PlotTypes.ATTACK_ARROW:
        return new AttackArrow$1([], points, params);
      case PlotTypes.FREE_POLYGON:
        return new FreePolygon$1([], points, params);
      case PlotTypes.DOUBLE_ARROW:
        return new DoubleArrow$1([], points, params);
      case PlotTypes.STRAIGHT_ARROW:
        return new StraightArrow$1([], points, params);
      case PlotTypes.FINE_ARROW:
        return new FineArrow$1([], points, params);
      case PlotTypes.ASSAULT_DIRECTION:
        return new AssaultDirection$1([], points, params);
      case PlotTypes.TAILED_ATTACK_ARROW:
        return new TailedAttackArrow$1([], points, params);
      case PlotTypes.SQUAD_COMBAT:
        return new SquadCombat$1([], points, params);
      case PlotTypes.TAILED_SQUAD_COMBAT:
        return new TailedSquadCombat$1([], points, params);
      case PlotTypes.GATHERING_PLACE:
        return new GatheringPlace$1([], points, params);
      case PlotTypes.RECTFLAG:
        return new RectFlag$1([], points, params);
      case PlotTypes.TRIANGLEFLAG:
        return new TriangleFlag$1([], points, params);
      case PlotTypes.CURVEFLAG:
        return new CurveFlag$1([], points, params);
      case PlotTypes.RECTINCLINED1:
        return new Rectinclined$3([], points, params);
      case PlotTypes.RECTINCLINED2:
        return new Rectinclined$1([], points, params);
      default:
        console.warn("暂不支持此类型", type);
    }
    return null;
  }
  active(type, params = {}) {
    this.activate(type, params);
    console.warn("[ol-plot]: active 方法即将废弃，请使用 activate");
  }
  /**
   * 激活工具
   * @param type
   * @param params
   */
  activate(type, params = {}) {
    this.deactivate();
    this.deactiveMapTools();
    this.plotType = type;
    this.plotParams = params;
    if (type === PlotTypes.TEXTAREA) {
      this.activeInteraction();
    } else if (Object.keys(PlotTypes).some((key) => PlotTypes[key] === type)) {
      this.map.on("click", this.mapFirstClickHandler);
    } else {
      console.warn("不存在的标绘类型！");
    }
  }
  /**
   * 激活交互工具
   */
  activeInteraction() {
    this.drawInteraction_ = new Draw({
      style: new Style({
        fill: new Fill({
          color: "rgba(255, 255, 255, 0.7)"
        }),
        stroke: new Stroke({
          color: "rgba(0, 0, 0, 0.15)",
          width: 2
        }),
        image: new Icon({
          anchor: [1, 1],
          anchorXUnits: "fraction",
          anchorYUnits: "fraction",
          opacity: 0.75,
          // eslint-disable-next-line max-len
          src: ""
        })
      }),
      type: "Circle",
      geometryFunction: createBox()
    });
    this.map.addInteraction(this.drawInteraction_);
    this.drawInteraction_.on("drawstart", this.textAreaDrawStart);
    this.drawInteraction_.on("drawend", this.textAreaDrawEnd);
  }
  textAreaDrawStart(event) {
    this.dispatchEvent(
      new PlotEvent("drawStart", {
        originalEvent: event,
        feature: null,
        plotType: PlotTypes.TEXTAREA
      })
    );
  }
  /**
   * 绘制结束
   * @param event
   */
  textAreaDrawEnd(event) {
    let _plotText;
    if (event && event.feature) {
      const extent = event.feature.getGeometry().getExtent();
      const _center = [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2];
      const topLeft = this.map.getPixelFromCoordinate([extent[0], extent[1]]);
      const bottomRight = this.map.getPixelFromCoordinate([extent[2], extent[3]]);
      const [_width, _height] = [Math.abs(topLeft[0] - bottomRight[0]), Math.abs(topLeft[1] - bottomRight[1])];
      _plotText = new PlotTextBox$1(
        {
          id: getuuid(),
          position: _center,
          value: "",
          width: _width,
          height: _height,
          style: {
            width: `${_width}px`,
            height: `${_height}px`
          }
        },
        this.ctx
      );
      if (this.map && this.map instanceof Map$1 && _plotText) {
        this.map.addOverlay(_plotText);
      } else {
        console.warn("未传入地图对象或者plotText创建失败！");
      }
    } else {
      console.info("未获取到要素！");
    }
    this.dispatchEvent(
      new PlotEvent("drawEnd", {
        originalEvent: event,
        feature: _plotText,
        plotType: PlotTypes.TEXTAREA
      })
    );
    this.deactivate();
  }
  disActive() {
    this.deactivate();
    console.warn("[ol-plot]: disActive 方法即将废弃，请使用 deactivate");
  }
  /**
   * 取消激活状态
   */
  deactivate() {
    this.removeEventHandlers();
    if (this.drawInteraction_) {
      this.map.removeInteraction(this.drawInteraction_);
      this.drawInteraction_ = null;
    }
    this.points = [];
    this.plot = null;
    this.feature = null;
    this.plotType = null;
    this.plotParams = null;
    this.activateMapTools();
  }
  /**
   * PLOT是否处于激活状态
   * @returns {boolean}
   */
  isDrawing() {
    return !!this.plotType;
  }
  /**
   * 地图事件处理
   * 激活工具后第一次点击事件
   * @param event
   */
  mapFirstClickHandler(event) {
    this.map.un("click", this.mapFirstClickHandler);
    this.points.push(event.coordinate);
    this.plot = this.createPlot(this.plotType, this.points, this.plotParams);
    if (!this.plot)
      return;
    this.feature = new Feature(this.plot);
    this.dispatchEvent(
      new PlotEvent("drawStart", {
        originalEvent: event,
        feature: this.feature,
        plotType: this.plotType
      })
    );
    this.feature.set("isPlot", true);
    this.drawLayer.getSource().addFeature(this.feature);
    if (this.plotType === PlotTypes.POINT || this.plotType === PlotTypes.PENNANT) {
      this.plot.finishDrawing();
      this.drawEnd(event);
    } else {
      this.map.on("click", this.mapNextClickHandler);
      if (!this.plot.freehand) {
        this.map.on("dblclick", this.mapDoubleClickHandler);
      }
      this.map.un("pointermove", this.mapMouseMoveHandler);
      this.map.on("pointermove", this.mapMouseMoveHandler);
    }
    if (this.plotType && this.feature) {
      this.plotParams.plotType = this.plotType;
      this.feature.setProperties(this.plotParams);
    }
  }
  /**
   * 地图点击事件处理
   * @param event
   * @returns {boolean}
   */
  mapNextClickHandler(event) {
    if (!this.plot)
      return;
    if (!this.plot.freehand) {
      if (MathDistance(event.coordinate, this.points[this.points.length - 1]) < 1e-4) {
        return false;
      }
    }
    this.points.push(event.coordinate);
    this.plot.setPoints(this.points);
    if (this.plot.fixPointCount === this.plot.getPointCount()) {
      this.mapDoubleClickHandler(event);
    }
    if (this.plot && this.plot.freehand) {
      this.mapDoubleClickHandler(event);
    }
  }
  /**
   * 地图双击事件处理
   * @param event
   */
  mapDoubleClickHandler(event) {
    event.preventDefault();
    if (!this.plot)
      return;
    this.plot.finishDrawing();
    this.drawEnd(event);
  }
  /**
   * 地图事件处理
   * 鼠标移动事件
   * @param event
   * @returns {boolean}
   */
  mapMouseMoveHandler(event) {
    const coordinate = event.coordinate;
    if (!this.plot)
      return;
    if (MathDistance(coordinate, this.points[this.points.length - 1]) < 1e-4) {
      return false;
    }
    if (!this.plot.freehand) {
      const pnts = this.points.concat([coordinate]);
      this.plot.setPoints(pnts);
    } else {
      this.points.push(coordinate);
      this.plot.setPoints(this.points);
    }
  }
  /**
   * 移除事件监听
   */
  removeEventHandlers() {
    this.map.un("click", this.mapFirstClickHandler);
    this.map.un("click", this.mapNextClickHandler);
    this.map.un("pointermove", this.mapMouseMoveHandler);
    this.map.un("dblclick", this.mapDoubleClickHandler);
  }
  /**
   * 绘制结束
   */
  drawEnd(event) {
    this.dispatchEvent(
      new PlotEvent("drawEnd", {
        originalEvent: event,
        feature: this.feature,
        plotType: this.plotType
      })
    );
    if (this.feature && this.options.isClear) {
      this.drawLayer.getSource().removeFeature(this.feature);
    }
    this.deactivate();
  }
  /**
   * 添加要素
   */
  addFeature() {
    this.feature = new Feature(this.plot);
    if (this.feature && this.drawLayer) {
      this.drawLayer.getSource().addFeature(this.feature);
    }
  }
  /**
   * 取消激活地图交互工具
   */
  deactiveMapTools() {
    const interactions = this.map.getInteractions().getArray();
    interactions.every((item) => {
      if (item instanceof DoubleClickZoom) {
        this.dblClickZoomInteraction = item;
        this.map.removeInteraction(item);
        return false;
      }
      return true;
    });
  }
  /**
   * 激活已取消的地图工具
   * 还原之前状态
   */
  activateMapTools() {
    if (this.dblClickZoomInteraction) {
      this.map.addInteraction(this.dblClickZoomInteraction);
      this.dblClickZoomInteraction = null;
    }
  }
}
const PlotDraw$1 = PlotDraw;
class PlotEdit extends Observable {
  constructor(map) {
    super();
    __publicField(this, "map");
    __publicField(this, "mapViewport");
    __publicField(this, "activePlot");
    __publicField(this, "startPoint");
    __publicField(this, "controlPoints");
    __publicField(this, "mouseOver");
    __publicField(this, "mapDragPan");
    __publicField(this, "activeControlPointId");
    __publicField(this, "elementTable");
    __publicField(this, "ghostControlPoints");
    __publicField(this, "previousCursor_");
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
    this.mapViewport = this.map.getViewport();
    this.activePlot = null;
    this.startPoint = null;
    this.ghostControlPoints = [];
    this.controlPoints = [];
    this.mouseOver = false;
    this.elementTable = {};
    this.activeControlPointId = null;
    this.mapDragPan = null;
    this.previousCursor_ = null;
    bindAll(
      [
        "controlPointMouseDownHandler",
        "controlPointMouseMoveHandler2",
        "controlPointMouseUpHandler",
        "controlPointMouseMoveHandler",
        "plotMouseOverOutHandler",
        "plotMouseDownHandler",
        "plotMouseUpHandler",
        "plotMouseMoveHandler",
        "handleContextmenu"
      ],
      this
    );
  }
  /**
   * 初始化提示DOM
   * @returns {boolean}
   */
  initHelperDom() {
    if (!this.map || !this.activePlot) {
      return false;
    }
    const parent = this.getMapParentElement();
    if (!parent) {
      return false;
    }
    const hiddenDiv = createHidden("div", parent, BASE_HELP_HIDDEN);
    const cPnts = this.getControlPoints();
    if (cPnts && Array.isArray(cPnts) && cPnts.length > 0) {
      cPnts.forEach((item, index2) => {
        const id = `${BASE_HELP_CONTROL_POINT_ID}-${index2}`;
        create("div", BASE_HELP_CONTROL_POINT_ID, hiddenDiv, id);
        this.elementTable[id] = index2;
      });
    }
  }
  /**
   * 获取地图元素的父元素
   * @returns {*}
   */
  getMapParentElement() {
    const mapElement = this.map.getTargetElement();
    if (!mapElement) {
      return false;
    }
    return mapElement.parentNode;
  }
  /**
   * 销毁帮助提示DOM
   */
  destroyHelperDom() {
    if (this.controlPoints && Array.isArray(this.controlPoints) && this.controlPoints.length > 0) {
      this.controlPoints.forEach((item, index2) => {
        if (item && item instanceof Overlay) {
          this.map.removeOverlay(item);
        }
        const element = getElement(`${BASE_HELP_CONTROL_POINT_ID}-${index2}`);
        if (element) {
          off(element, "contextmenu", this.handleContextmenu);
          off(element, "mousedown", this.controlPointMouseDownHandler);
          off(element, "mousemove", this.controlPointMouseMoveHandler2);
        }
      });
      this.controlPoints = [];
    }
    const hiddenDiv = getElement(BASE_HELP_HIDDEN);
    if (hiddenDiv) {
      remove(hiddenDiv);
    }
  }
  /**
   * 初始化要素控制点
   */
  initControlPoints() {
    this.controlPoints = [];
    const cPnts = this.getControlPoints();
    if (cPnts && Array.isArray(cPnts) && cPnts.length > 0) {
      cPnts.forEach((item, index2) => {
        const id = `${BASE_HELP_CONTROL_POINT_ID}-${index2}`;
        this.elementTable[id] = index2;
        const element = getElement(id);
        if (element) {
          const pnt = new Overlay({
            id,
            position: cPnts[index2],
            positioning: "center-center",
            element
          });
          this.controlPoints.push(pnt);
          this.map.addOverlay(pnt);
          this.map.render();
          on(element, "contextmenu", this.handleContextmenu);
          on(element, "mousedown", this.controlPointMouseDownHandler);
          on(element, "mousemove", this.controlPointMouseMoveHandler2);
        }
      });
    }
  }
  handleContextmenu(e2) {
    e2.preventDefault();
  }
  /**
   * 对控制点的移动事件
   * @param e
   */
  controlPointMouseMoveHandler2(e2) {
    e2.stopImmediatePropagation();
  }
  /**
   * 对控制点的鼠标按下事件
   * @param e
   */
  controlPointMouseDownHandler(e2) {
    this.activeControlPointId = e2.target.id;
    this.map.un("pointermove", this.controlPointMouseMoveHandler);
    this.map.on("pointermove", this.controlPointMouseMoveHandler);
    on(this.mapViewport, "mouseup", this.controlPointMouseUpHandler);
    document.addEventListener("mouseup", this.controlPointMouseUpHandler, true);
  }
  /**
   * 对控制点的移动事件
   * @param event
   */
  controlPointMouseMoveHandler(event) {
    const coordinate = event.coordinate;
    if (this.activeControlPointId) {
      const plot = this.activePlot.getGeometry();
      const index2 = this.elementTable[this.activeControlPointId];
      plot.updatePoint(coordinate, index2);
      const overlay = this.map.getOverlayById(this.activeControlPointId);
      if (overlay) {
        overlay.setPosition(coordinate);
      }
    }
  }
  /**
   * 对控制点的鼠标抬起事件
   */
  controlPointMouseUpHandler() {
    this.map.un("pointermove", this.controlPointMouseMoveHandler);
    off(this.mapViewport, "mouseup", this.controlPointMouseUpHandler);
    document.removeEventListener("mouseup", this.controlPointMouseUpHandler, true);
  }
  /**
   * 激活工具
   * @param plot
   * @returns {boolean}
   */
  activate(plot) {
    if (plot && plot instanceof Feature && plot.get("isPlot") && plot.getGeometry().isPlot && plot !== this.activePlot) {
      this.deactivate();
      this.activePlot = plot;
      this.previousCursor_ = this.map.getTargetElement().style.cursor;
      window.setTimeout(() => {
        this.dispatchEvent(
          new PlotEvent("activePlotChange", {
            feature: this.activePlot
          })
        );
      }, 0);
      this.map.on("pointermove", this.plotMouseOverOutHandler);
      this.initHelperDom();
      this.initControlPoints();
    }
  }
  /**
   * 获取要素的控制点
   * @returns {Array}
   */
  getControlPoints() {
    let points = [];
    if (this.activePlot) {
      const geom = this.activePlot.getGeometry();
      if (geom) {
        points = geom.getPoints();
      }
    }
    return points;
  }
  /**
   * 鼠标移出要编辑的要素范围
   * @param e
   * @returns {T|undefined}
   */
  plotMouseOverOutHandler(e2) {
    const feature = this.map.forEachFeatureAtPixel(e2.pixel, (f) => f);
    if (feature && feature === this.activePlot) {
      if (!this.mouseOver) {
        this.mouseOver = true;
        this.map.getTargetElement().style.cursor = "move";
        this.map.on("pointerdown", this.plotMouseDownHandler);
      }
    } else if (this.mouseOver) {
      this.mouseOver = false;
      this.map.getTargetElement().style.cursor = "default";
      this.map.un("pointerdown", this.plotMouseDownHandler);
    }
    return feature;
  }
  /**
   * 在要编辑的要素按下鼠标按键
   * @param event
   */
  plotMouseDownHandler(event) {
    this.ghostControlPoints = this.getControlPoints();
    this.startPoint = event.coordinate;
    this.disableMapDragPan();
    this.map.on("pointerup", this.plotMouseUpHandler);
    this.map.on("pointerdrag", this.plotMouseMoveHandler);
  }
  /**
   * 在要编辑的要素上移动鼠标
   * @param event
   */
  plotMouseMoveHandler(event) {
    if (!this.startPoint)
      return;
    const [deltaX, deltaY, newPoints] = [
      event.coordinate[0] - this.startPoint[0],
      event.coordinate[1] - this.startPoint[1],
      []
    ];
    if (this.ghostControlPoints && Array.isArray(this.ghostControlPoints) && this.ghostControlPoints.length > 0) {
      for (let i = 0; i < this.ghostControlPoints.length; i++) {
        const coordinate = [this.ghostControlPoints[i][0] + deltaX, this.ghostControlPoints[i][1] + deltaY];
        newPoints.push(coordinate);
        const id = `${BASE_HELP_CONTROL_POINT_ID}-${i}`;
        const overlay = this.map.getOverlayById(id);
        if (overlay) {
          overlay.setPosition(coordinate);
          overlay.setPositioning("center-center");
        }
      }
    }
    const _geometry = this.activePlot.getGeometry();
    _geometry.setPoints(newPoints);
  }
  /**
   * 鼠标抬起事件
   */
  plotMouseUpHandler() {
    this.enableMapDragPan();
    this.map.un("pointerup", this.plotMouseUpHandler);
    this.map.un("pointerdrag", this.plotMouseMoveHandler);
  }
  /**
   * 取消事件关联
   */
  disconnectEventHandlers() {
    this.map.un("pointermove", this.plotMouseOverOutHandler);
    this.map.un("pointermove", this.controlPointMouseMoveHandler);
    document.removeEventListener("mouseup", this.controlPointMouseUpHandler, true);
    off(this.mapViewport, "mouseup", this.controlPointMouseUpHandler);
    this.map.un("pointerdown", this.plotMouseDownHandler);
    this.map.un("pointerup", this.plotMouseUpHandler);
    this.map.un("pointerdrag", this.plotMouseMoveHandler);
  }
  /**
   * 取消激活工具
   */
  deactivate() {
    if (this.activePlot) {
      this.dispatchEvent(
        new PlotEvent("deactivatePlot", {
          feature: this.activePlot
        })
      );
    }
    this.activePlot = null;
    this.mouseOver = false;
    this.map.getTargetElement().style.cursor = this.previousCursor_;
    this.previousCursor_ = null;
    this.destroyHelperDom();
    this.disconnectEventHandlers();
    this.enableMapDragPan();
    this.elementTable = {};
    this.activeControlPointId = null;
    this.startPoint = null;
  }
  /**
   * 禁止地图的拖拽平移
   */
  disableMapDragPan() {
    const interactions = this.map.getInteractions().getArray();
    interactions.every((item) => {
      if (item instanceof DragPan) {
        this.mapDragPan = item;
        this.map.removeInteraction(item);
        return false;
      }
      return true;
    });
  }
  /**
   * 激活地图的拖拽平移
   */
  enableMapDragPan() {
    if (this.mapDragPan) {
      this.map.addInteraction(this.mapDragPan);
      this.mapDragPan = null;
    }
  }
}
const PlotEdit$1 = PlotEdit;
class StyleFactory {
  constructor(options) {
    __publicField(this, "style");
    const option = options && typeof options === "object" ? options : {};
    const style = new Style({});
    if (option.geometry && option.geometry instanceof Geometry$1) {
      style.setGeometry(option.geometry);
    }
    if (option.zIndex && typeof option.zIndex === "number") {
      style.setZIndex(option.zIndex);
    }
    if (option.fill && typeof option.fill === "object") {
      style.setFill(this._getFill(option.fill));
    }
    if (option.image && typeof option.image === "object") {
      style.setImage(this._getImage(option.image));
    }
    if (option.stroke && typeof option.stroke === "object") {
      style.setStroke(this._getStroke(option.stroke));
    }
    if (option.text && typeof option.text === "object") {
      style.setText(this._getText(option.text));
    }
    this.style = style;
  }
  /**
   * 获取规则样式图形
   * @param options
   * @returns {*}
   * @private
   */
  _getRegularShape(options) {
    return new RegularShape({
      fill: this._getFill(options.fill) || void 0,
      points: typeof options.points === "number" ? options.points : 1,
      radius: typeof options.radius === "number" ? options.radius : void 0,
      radius1: typeof options.radius1 === "number" ? options.radius1 : void 0,
      radius2: typeof options.radius2 === "number" ? options.radius2 : void 0,
      angle: typeof options.angle === "number" ? options.angle : 0,
      stroke: this._getStroke(options.stroke) || void 0,
      rotation: typeof options.rotation === "number" ? options.rotation : 0,
      rotateWithView: typeof options.rotateWithView === "boolean" ? options.rotateWithView : false,
      // @ts-ignore this is unsafe
      atlasManager: options.atlasManager ? options.atlasManager : void 0
    });
  }
  /**
   * 获取图标样式
   * @param options
   * @returns {*}
   * @private
   */
  _getImage(options) {
    let image;
    options = options || {};
    if (options.type === "icon") {
      image = this._getIcon(options.image);
    } else {
      image = this._getRegularShape(options.image);
    }
    return image;
  }
  /**
   * 获取icon
   * @param options
   * @returns {Icon}
   * @private
   */
  _getIcon(options) {
    options = options || {};
    return new Icon({
      anchor: options.imageAnchor ? options.imageAnchor : [0.5, 0.5],
      anchorXUnits: options.imageAnchorXUnits ? options.imageAnchorXUnits : "fraction",
      anchorYUnits: options.imageAnchorYUnits ? options.imageAnchorYUnits : "fraction",
      anchorOrigin: options.imageAnchorOrigin ? options.imageAnchorYUnits : "top-left",
      color: options.imageColor ? options.imageColor : void 0,
      crossOrigin: options.crossOrigin ? options.crossOrigin : void 0,
      img: options.img ? options.img : void 0,
      offset: options.offset && Array.isArray(options.offset) && options.offset.length === 2 ? options.offset : [0, 0],
      offsetOrigin: options.offsetOrigin ? options.offsetOrigin : "top-left",
      scale: typeof options.scale === "number" ? options.scale : 1,
      rotateWithView: typeof options.rotateWithView === "boolean" ? options.rotateWithView : false,
      opacity: typeof options.imageOpacity === "number" ? options.imageOpacity : 1,
      rotation: typeof options.imageRotation === "number" ? options.imageRotation : 0,
      size: options.size && Array.isArray(options.size) && options.size.length === 2 ? options.size : void 0,
      imgSize: options.imgSize && Array.isArray(options.imgSize) && options.imgSize.length === 2 ? options.imgSize : void 0,
      src: options.imageSrc ? options.imageSrc : void 0
    });
  }
  /**
   * 获取线条样式
   * @param options
   * @returns {Stroke}
   * @private
   */
  _getStroke(options) {
    options = options || {};
    return new Stroke({
      color: options.strokeColor ? options.strokeColor : void 0,
      lineCap: options.strokeLineCap && typeof options.strokeLineCap === "string" ? options.strokeLineCap : "round",
      lineJoin: options.strokeLineJoin && typeof options.strokeLineJoin === "string" ? options.strokeLineJoin : "round",
      lineDash: options.strokeLineDash ? options.strokeLineDash : void 0,
      lineDashOffset: typeof options.strokeLineDashOffset === "number" ? options.strokeLineDashOffset : "0",
      miterLimit: typeof options.strokeMiterLimit === "number" ? options.strokeMiterLimit : 10,
      width: typeof options.strokeWidth === "number" ? options.strokeWidth : void 0
    });
  }
  /**
   * 获取样式文本
   * @param options
   * @returns {Text}
   * @private
   */
  _getText(options) {
    return new Text({
      font: options.textFont && typeof options.textFont === "string" ? options.textFont : "10px sans-serif",
      offsetX: typeof options.textOffsetX === "number" ? options.textOffsetX : 0,
      offsetY: typeof options.textOffsetY === "number" ? options.textOffsetY : 0,
      scale: typeof options.textScale === "number" ? options.textScale : void 0,
      rotation: typeof options.textRotation === "number" ? options.textRotation : 0,
      text: options.text && typeof options.text === "string" ? options.text : void 0,
      textAlign: options.textAlign && typeof options.textAlign === "string" ? options.textAlign : "start",
      textBaseline: options.textBaseline && typeof options.textBaseline === "string" ? options.textBaseline : "alphabetic",
      rotateWithView: typeof options.rotateWithView === "boolean" ? options.rotateWithView : false,
      fill: this._getFill(options.textFill),
      stroke: this._getStroke(options.textStroke)
    });
  }
  /**
   * 获取填充颜色
   * @param options
   * @returns {Fill}
   * @private
   */
  _getFill(options) {
    options = options || {};
    return new Fill({
      color: options.fillColor ? options.fillColor : void 0
    });
  }
}
const StyleFactory$1 = StyleFactory;
class PlotUtils {
  constructor(map, options, ctx) {
    __publicField(this, "map");
    __publicField(this, "ctx");
    __publicField(this, "options");
    __publicField(this, "layerName");
    if (map && map instanceof Map$1) {
      this.map = map;
    } else {
      throw new Error("传入的不是地图对象！");
    }
    this.ctx = ctx;
    this.options = options;
    this.layerName = this.options && this.options.layerName ? this.options.layerName : BASE_LAYERNAME;
  }
  /**
   * 获取样式信息
   * @param feature
   * @returns {boolean}
   */
  getBaseStyle(feature) {
    let style = feature.getStyle();
    if (!style) {
      const layer = getLayerByLayerName(this.map, this.layerName);
      if (layer && layer instanceof Vector) {
        style = layer.getStyle();
      } else {
        return false;
      }
    }
    return style;
  }
  /**
   * 设置点类型的图标样式
   * @param feature
   * @param image
   */
  setIcon(feature, image) {
    try {
      if (feature && feature instanceof Feature) {
        const style = this.getBaseStyle(feature);
        const tempStyle = style.clone();
        const _image = this.getImage_(image);
        if (_image) {
          tempStyle.setImage(_image);
          feature.setStyle(tempStyle);
        }
      }
    } catch (e2) {
      console.warn(e2);
    }
  }
  /**
   * 设置背景颜色
   * @param feature
   * @param backgroundColor
   * @returns {boolean}
   */
  setBackgroundColor(feature, backgroundColor) {
    try {
      if (feature && feature instanceof Feature) {
        const style = this.getBaseStyle(feature);
        const tempStyle = style.clone();
        const fill = tempStyle.getFill();
        const color = fill.getColor();
        if (color) {
          const tempColor = asArray(color);
          const _color = asArray(backgroundColor);
          const currentColor = this.handleBackgroundColor(_color, tempColor[3]);
          fill.setColor(currentColor);
          feature.setStyle(tempStyle);
        }
      }
    } catch (e2) {
      console.warn(e2);
    }
  }
  /**
   * 设置透明度
   * @param feature
   * @param opacity
   */
  setOpacity(feature, opacity) {
    try {
      if (feature && feature instanceof Feature) {
        const style = this.getBaseStyle(feature);
        if (style) {
          const tempStyle = style.clone();
          const fill = tempStyle.getFill();
          const color = fill.getColor();
          if (color) {
            const tempColor = asArray(color);
            tempColor[3] = opacity;
            const currentColor = `rgba(${tempColor.join(",")})`;
            fill.setColor(currentColor);
            feature.setStyle(tempStyle);
          }
        }
      }
    } catch (e2) {
      console.warn(e2);
    }
  }
  /**
   * 设置边框颜色
   * @param feature
   * @param borderColor
   */
  setBorderColor(feature, borderColor) {
    try {
      if (feature && feature instanceof Feature) {
        const style = this.getBaseStyle(feature);
        const tempStyle = style.clone();
        const stroke = tempStyle.getStroke();
        stroke.setColor(borderColor);
        feature.setStyle(tempStyle);
      }
    } catch (e2) {
      console.warn(e2);
    }
  }
  /**
   * 设置边框宽度
   * @param feature
   * @param borderWidth
   */
  setBorderWidth(feature, borderWidth) {
    try {
      if (feature && feature instanceof Feature) {
        const style = this.getBaseStyle(feature);
        const tempStyle = style.clone();
        const stroke = tempStyle.getStroke();
        stroke.setWidth(borderWidth);
        feature.setStyle(tempStyle);
      }
    } catch (e2) {
      console.warn(e2);
    }
  }
  /**
   * 处理背景色
   * @param color
   * @param opacity
   * @returns {string}
   */
  handleBackgroundColor(color, opacity) {
    try {
      if (!opacity)
        opacity = 1;
      const tempColor = asArray(color);
      tempColor[3] = opacity;
      return `rgba(${tempColor.join(",")})`;
    } catch (e2) {
      console.warn(e2);
    }
  }
  /**
   * 获取颜色值
   * @param color
   * @returns {string}
   */
  getColor(color) {
    try {
      const colorTarget = asArray(color);
      return asString(colorTarget);
    } catch (e2) {
      console.warn(e2);
    }
  }
  /**
   * 去除无值的字段
   * @param obj
   * @returns {*}
   */
  fixObject(obj) {
    if (obj && typeof obj === "object") {
      for (const key in obj) {
        if (key && typeof obj[key] === "undefined") {
          delete obj[key];
        }
      }
    }
    return obj;
  }
  /**
   * 获取stroke
   * @param style
   * @returns {*}
   */
  getStroke_(style) {
    let stroke;
    if (style) {
      const olStyle_ = style.getStroke();
      if (olStyle_) {
        stroke = {};
        stroke.strokeColor = this.getColor(olStyle_.getColor());
        stroke.strokeWidth = olStyle_.getWidth();
        stroke.strokeLineDash = olStyle_.getLineDash();
        stroke.lineDashOffset = olStyle_.getLineDashOffset();
        stroke.strokeLineCap = olStyle_.getLineCap();
        stroke.strokeLineJoin = olStyle_.getLineJoin();
        stroke.strokeMiterLimit = olStyle_.getMiterLimit();
      }
    }
    return this.fixObject(stroke);
  }
  /**
   * 获取填充色
   * @param style
   * @returns {*}
   * @private
   */
  getFill_(style) {
    let fill;
    if (style) {
      const olStyle_ = style.getFill();
      if (olStyle_) {
        fill = {};
        const color = olStyle_.getColor();
        fill.fillColor = this.getColor(color);
      }
    }
    return this.fixObject(fill);
  }
  /**
   * 获取文本信息
   * @param style
   * @returns {*}
   * @private
   */
  getText_(style) {
    let text;
    if (style) {
      const olStyle_ = style.getText();
      if (olStyle_) {
        text = {};
        text.textFont = olStyle_.getFont();
        text.textOffsetX = olStyle_.getOffsetX();
        text.textOffsetY = olStyle_.getOffsetY();
        text.textScale = olStyle_.getScale();
        text.textRotation = olStyle_.getRotation();
        text.text = olStyle_.getText();
        text.textAlign = olStyle_.getTextAlign();
        text.textBaseline = olStyle_.getTextBaseline();
        text.rotateWithView = olStyle_.getRotateWithView();
        text.textFill = this.getFill_(olStyle_);
        text.textStroke = this.getStroke_(olStyle_);
      }
    }
    return this.fixObject(text);
  }
  /**
   * 获取图像信息
   * @param style
   * @returns {*}
   * @private
   */
  getImage_(style) {
    let image;
    if (style) {
      const olStyle_ = style.getImage();
      if (olStyle_) {
        image = {};
        if (olStyle_ instanceof Icon) {
          image.type = "icon";
          image.image = {};
          image.image.imageAnchor = olStyle_.getAnchor();
          image.image.imageColor = olStyle_.getColor();
          image.image.imageSrc = olStyle_.getSrc();
          image.image.imgSize = olStyle_.getSize();
          image.image.scale = olStyle_.getScale();
          image.image.imageRotation = olStyle_.getRotation();
          image.image.rotateWithView = olStyle_.getRotateWithView();
          image.image.imageOpacity = olStyle_.getOpacity();
          image.image.offset = olStyle_.getOrigin();
        } else if (olStyle_ instanceof RegularShape) {
          image.type = "";
          image.image = {};
          image.image.fill = this.getFill_(olStyle_);
          image.image.points = olStyle_.getPoints();
          image.image.radius = olStyle_.getRadius();
          image.image.radius2 = olStyle_.getRadius2();
          image.image.angle = olStyle_.getAngle();
          image.image.stroke = this.getStroke_(olStyle_);
          image.image.rotateWithView = olStyle_.getRotateWithView();
        }
      }
    }
    return this.fixObject(image);
  }
  /**
   * 获取样式配置
   * @param feature
   * @returns {{fill: {fillColor: string, opacity: number}, stroke: *, image: *, text: *}}
   */
  getStyleCode(feature) {
    try {
      if (feature && feature instanceof Feature) {
        const style = this.getBaseStyle(feature);
        if (style && style instanceof Style) {
          const fill = this.getFill_(style);
          let opacity = 1;
          let backgroundColor;
          if (fill && fill.fillColor) {
            const rgbaArray = asArray(fill.fillColor);
            opacity = parseFloat(String(rgbaArray[3]));
            if (rgbaArray && typeof opacity === "number") {
              backgroundColor = this.handleBackgroundColor(asString(rgbaArray), opacity);
            }
          }
          const stroke = this.getStroke_(style);
          const text = this.getText_(style);
          const icon = this.getImage_(style);
          return {
            fill: {
              fillColor: backgroundColor,
              opacity
            },
            stroke,
            image: icon,
            text
          };
        }
      }
    } catch (e2) {
      console.warn(e2);
    }
  }
  /**
   * 移除图层上所有的数据
   */
  removeAllFeatures() {
    const layer = getLayerByLayerName(this.map, this.layerName);
    const overlays_ = this.map.getOverlays().getArray();
    if (layer) {
      const source = layer.getSource();
      source.clear();
    }
    if (overlays_ && overlays_.length > 0) {
      const len = overlays_.length;
      for (let i = 0; i < len; i++) {
        if (overlays_[i] && overlays_[i].get("isPlotText")) {
          this.map.removeOverlay(overlays_[i]);
          i--;
        }
      }
    }
  }
  /**
   * 获取所有的要素包含样式信息的GeoJSON
   * @returns {Array}
   */
  getFeatures() {
    const rFeatures = [];
    const layer = getLayerByLayerName(this.map, this.layerName);
    if (layer) {
      const source = layer.getSource();
      if (source && source instanceof Vector$1) {
        const features = source.getFeatures();
        if (features && features.length > 0) {
          features.forEach((feature) => {
            if (feature && feature.getGeometry) {
              const geom = feature.getGeometry();
              if (geom && geom.getCoordinates) {
                const type = geom.getType();
                const coordinates = geom.getCoordinates();
                rFeatures.push({
                  type: "Feature",
                  geometry: {
                    type,
                    coordinates
                  },
                  properties: {
                    type: feature.getGeometry().getPlotType(),
                    style: this.getStyleCode(feature),
                    points: feature.getGeometry().getPoints()
                  }
                });
              }
            }
          });
        }
      }
    }
    const overlays_ = this.map.getOverlays().getArray();
    overlays_.forEach((overlay) => {
      if (overlay.get("isPlotText")) {
        const style_ = overlay.getStyle();
        style_.width = `${overlay.getWidth()}px`;
        style_.height = `${overlay.getHeight()}px`;
        rFeatures.push({
          type: "Feature",
          geometry: {
            type: "PlotText",
            coordinates: overlay.getPosition()
          },
          properties: {
            id: overlay.getId(),
            width: overlay.getWidth(),
            height: overlay.getHeight(),
            style: style_,
            value: overlay.getValue()
          }
        });
      }
    });
    return rFeatures;
  }
  /**
   * 恢复相关标绘
   * @param features
   */
  addFeatures(features) {
    if (features && Array.isArray(features) && features.length > 0) {
      let layer = getLayerByLayerName(this.map, this.layerName);
      if (!layer) {
        layer = createVectorLayer(this.map, this.layerName, {
          create: true
        });
        layer.setZIndex(this.options.zIndex || 99);
      }
      if (layer) {
        const source = layer.getSource();
        if (source && source instanceof Vector$1) {
          const _extents = [];
          features.forEach((feature) => {
            if (feature && feature.geometry && feature.geometry.type !== "PlotText") {
              if (feature.properties.type && Geometry[feature.properties.type]) {
                const feat = new Feature({
                  geometry: new Geometry[feature.properties.type]([], feature.properties.points, feature.properties)
                });
                feat.set("isPlot", true);
                _extents.push(feat.getGeometry().getExtent());
                if (feature.properties.style) {
                  const style_ = new StyleFactory$1(feature.properties.style).style;
                  if (style_) {
                    feat.setStyle(style_);
                  }
                }
                source.addFeature(feat);
              } else {
                console.warn("不存在的标绘类型！");
              }
            } else if (feature && feature.geometry && feature.geometry.type === "PlotText") {
              _extents.push(new Point$2(feature.geometry.coordinates).getExtent());
              const _plotText = new PlotTextBox$1(
                {
                  id: feature.properties.id,
                  position: feature.geometry.coordinates,
                  width: feature.properties.width,
                  height: feature.properties.height,
                  value: feature.properties.value,
                  style: feature.properties.style
                },
                this.ctx
              );
              if (this.map && this.map instanceof Map$1 && _plotText) {
                this.map.addOverlay(_plotText);
              } else {
                console.warn("未传入地图对象或者plotText创建失败！");
              }
            }
          });
          if (this.options.zoomToExtent && _extents && _extents.length > 0) {
            const _extent = this._getExtent(_extents);
            const size = this.map.getSize();
            const _view = this.map.getView();
            _view.fit(_extent, {
              size,
              duration: 800,
              maxZoom: _view.getMaxZoom() || void 0
            });
          }
        }
      }
    }
  }
  /**
   * get extent
   * @private
   */
  _getExtent(extents, params = {}) {
    const bbox = [
      Number.POSITIVE_INFINITY,
      Number.POSITIVE_INFINITY,
      Number.NEGATIVE_INFINITY,
      Number.NEGATIVE_INFINITY
    ];
    let _extent = extents.reduce(
      (prev, coord) => [
        Math.min(coord[0], prev[0]),
        Math.min(coord[1], prev[1]),
        Math.max(coord[2], prev[2]),
        Math.max(coord[3], prev[3])
      ],
      bbox
    );
    const size = getSize(_extent);
    const adjust = typeof params.adjust === "number" ? params.adjust : 0.2;
    const minWidth = typeof params.minWidth === "number" ? params.minWidth : 0.05;
    const minHeight = typeof params.minHeight === "number" ? params.minHeight : 0.05;
    if (size[0] <= minWidth || size[1] <= minHeight) {
      const bleft = getBottomLeft(_extent);
      const tright = getTopRight(_extent);
      const xmin = bleft[0] - adjust;
      const ymin = bleft[1] - adjust;
      const xmax = tright[0] + adjust;
      const ymax = tright[1] + adjust;
      _extent = buffer([xmin, ymin, xmax, ymax], adjust);
    }
    return _extent;
  }
}
const PlotUtils$1 = PlotUtils;
class olPlot extends Observable {
  constructor(map, options) {
    super();
    __publicField(this, "plotDraw");
    __publicField(this, "plotEdit");
    __publicField(this, "plotUtils");
    this.plotDraw = new PlotDraw$1(map, options, this);
    this.plotEdit = new PlotEdit$1(map);
    this.plotUtils = new PlotUtils$1(map, options, this);
  }
}
__publicField(olPlot, "PlotTypes", PlotTypes);
__publicField(olPlot, "Geometry", Geometry);
__publicField(olPlot, "StyleFactory", StyleFactory$1);
export {
  olPlot
};

